Thread (15 messages) 15 messages, 2 authors, 2021-12-27

Re: [PATCH v7 3/7] progress.c tests: make start/stop commands on stdin

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-12-27 01:33:27

On Mon, Dec 27 2021, Johannes Altmanninger wrote:

[Will reply to the rest later, thanks for the review...]
On Fri, Dec 17, 2021 at 05:24:58AM +0100, Ævar Arnfjörð Bjarmason wrote:
[...]
quoted
 int cmd__progress(int argc, const char **argv)
 {
-	int total = 0;
-	const char *title;
+	const char *const default_title = "Working hard";
+	struct string_list titles = STRING_LIST_INIT_DUP;
 	struct strbuf line = STRBUF_INIT;
-	struct progress *progress;
+	struct progress *progress = NULL;
 
 	const char *usage[] = {
-		"test-tool progress [--total=<n>] <progress-title>",
+		"test-tool progress <stdin",
 		NULL
(unrelated: I'd always add a trailing comma if I can, even though in this case it won't ever matter)
FWIW this bit is intentional coding style in git.git, see Junio's
https://lore.kernel.org/git/xmqqk0g5656r.fsf@gitster.g/ (local):
    
    It is a good idea to leave a comma even after the last element,
    _unless_ there is a strong reason why the element that currently is
    at the last MUST stay to be last when new elements are added[...]

Well, in that case he's talking about enums, but the same applies even
more to these sorts of lists here the NULL must remain the last element.
    
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help