git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] difftool: Change prompt to display the number of files in the diff queue

From
Jeff King <peff@peff.net>
Date
Dec 16, 2013, 20:02 UTC
Message-ID
<20131216200221.GA23689@sigill.intra.peff.net>
In-Reply-To
<1386286726-26653-1-git-send-email-zoltan.klinger@gmail.com>
On Fri, Dec 06, 2013 at 10:38:46AM +1100, Zoltan Klinger wrote:
Show 9 quoted lines
> @@ -2928,7 +2933,14 @@ static void run_external_diff(const char *pgm,
>  	}
>  	*arg = NULL;
>  	fflush(NULL);
> -	retval = run_command_v_opt(spawn_arg, RUN_USING_SHELL);
> +
> +	env[0] = env_counter;
> +	snprintf(env_counter, sizeof(env_counter), "GIT_DIFF_PATH_COUNTER=%d",
> +			++o->diff_path_counter);

I don't think we have a particular rule, but our usual style is to line up the continued line of arguments with the open-paren of the function, like:

  foo(arg1, arg2,
      arg3, arg4);
Show 6 quoted lines
> @@ -3317,6 +3329,8 @@ void diff_setup_done(struct diff_options *options)
>  		options->output_format = DIFF_FORMAT_NO_OUTPUT;
>  		DIFF_OPT_SET(options, EXIT_WITH_STATUS);
>  	}
> +
> +    options->diff_path_counter = 0;

It's hard to see with the email quoting, but this is a 4-space indent rather than the usual 1-tab (which should be 8-wide on the terminals of all True Believers).

Both are minor, but worth fixing IMHO (especially the second one). Looks like it's too late for squashing, so here's a patch that can go on top (doing it now is still of value, though, as it's less likely to create conflicts since nobody is building on top yet).

-- >8 --
Subject: diff.c: fix some recent whitespace style violations
These were introduced by ee7fb0b.
Signed-off-by: Jeff King <peff@peff.net>
---
On top of zk/difftool-counts.
 diff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/diff.c b/diff.c
index a7d5a47..d69cc1b 100644
--- a/diff.c
+++ b/diff.c
@@ -2936,7 +2936,7 @@ static void run_external_diff(const char *pgm,
 
 	env[0] = env_counter;
 	snprintf(env_counter, sizeof(env_counter), "GIT_DIFF_PATH_COUNTER=%d",
-			++o->diff_path_counter);
+		 ++o->diff_path_counter);
 	env[1] = env_total;
 	snprintf(env_total, sizeof(env_total), "GIT_DIFF_PATH_TOTAL=%d", q->nr);
 
@@ -3330,7 +3330,7 @@ void diff_setup_done(struct diff_options *options)
 		DIFF_OPT_SET(options, EXIT_WITH_STATUS);
 	}
 
-    options->diff_path_counter = 0;
+	options->diff_path_counter = 0;
 }
 
 static int opt_arg(const char *arg, int arg_short, const char *arg_long, int *val)
-- 
1.8.5.1.399.g900e7cd
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 6 in “difftool: Change prompt to display the number of files in the diff queue”
  1. difftool: Change prompt to display the number of files in the diff queueZoltan Klinger, Dec 5, 2013
  2. Junio C HamanoDec 6, 2013
  3. Jeff KingDec 16, 2013
  4. Junio C HamanoDec 16, 2013
  5. David AguilarDec 18, 2013
  6. Junio C HamanoDec 18, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.