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

Re: [PATCH 1/1] range-diff: let '--abbrev' option takes effect

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 21, 2023, 22:01 UTC
Message-ID
<xmqqzg96d6f2.fsf@gitster.g>
In-Reply-To
<20230220142444.18739-2-tenglong.tl@alibaba-inc.com>
Teng Long <dyroneteng@gmail.com> writes:
Show 12 quoted lines
> diff --git a/range-diff.c b/range-diff.c
> index 8255ab43..086365df 100644
> --- a/range-diff.c
> +++ b/range-diff.c
> @@ -383,11 +383,14 @@ static void output_pair_header(struct diff_options *diffopt,
>  	const char *color_new = diff_get_color_opt(diffopt, DIFF_FILE_NEW);
>  	const char *color_commit = diff_get_color_opt(diffopt, DIFF_COMMIT);
>  	const char *color;
> +	char abbrev = diffopt->abbrev;
> +
> +	if (abbrev < 0)
> +		abbrev = DEFAULT_ABBREV;

OK. I _think_ this explicit defaulting to DEFAULT_ABBREV does not need to exist, as find_unique_abbrev() falls back to the default when given a negative value anyway, but it is good to be explicit.

Will queue.  Thanks.
Previous: Teng LongNext: René Scharfe
Message 3 of 5 in “range-diff: let '--abbrev' option takes effect”
  1. 0/1 range-diff: let '--abbrev' option takes effectTeng Long, Feb 20, 2023
  2. 1/1 range-diff: let '--abbrev' option takes effectTeng Long, Feb 20, 2023
  3. Junio C HamanoFeb 21, 2023
  4. range-diff: avoid compiler warning when char is unsignedRené Scharfe, Feb 28, 2023
  5. Junio C HamanoFeb 28, 2023

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.