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

Re: [PATCH 2/2] use strbuf_add_unique_abbrev() for adding short hashes, part 2

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 27, 2016, 20:28 UTC
Message-ID
<xmqqshslm6jo.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<29e75b7b-6dd0-8c52-e444-cad1ba613cd0@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 10 quoted lines
> diff --git a/diff.c b/diff.c
> index a178ed3..be11e4e 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -3109,7 +3109,7 @@ static void fill_metainfo(struct strbuf *msg,
>  		}
>  		strbuf_addf(msg, "%s%sindex %s..", line_prefix, set,
>  			    find_unique_abbrev(one->oid.hash, abbrev));
> -		strbuf_addstr(msg, find_unique_abbrev(two->oid.hash, abbrev));
> +		strbuf_add_unique_abbrev(msg, two->oid.hash, abbrev);
OK.
Show 10 quoted lines
> diff --git a/submodule.c b/submodule.c
> index dcc5ce3..8cf40ea 100644
> --- a/submodule.c
> +++ b/submodule.c
> @@ -396,7 +396,7 @@ static void show_submodule_header(FILE *f, const char *path,
>  			find_unique_abbrev(one->hash, DEFAULT_ABBREV));
>  	if (!fast_backward && !fast_forward)
>  		strbuf_addch(&sb, '.');
> -	strbuf_addstr(&sb, find_unique_abbrev(two->hash, DEFAULT_ABBREV));
> +	strbuf_add_unique_abbrev(&sb->hash, two, DEFAULT_ABBREV);
I wonder how could this change come out of this definition:
    @@
    expression E1, E2, E3;
    @@
    - strbuf_addstr(E1, find_unique_abbrev(E2, E3));
    + strbuf_add_unique_abbrev(E1, E2, E3);
Previous: René ScharfeNext: René Scharfe
Message 3 of 6 in “use strbuf_addstr() instead of strbuf_addf() with "%s", part 2”
  1. 1/2 use strbuf_addstr() instead of strbuf_addf() with "%s", part 2René Scharfe, Sep 27, 2016
  2. 2/2 use strbuf_add_unique_abbrev() for adding short hashes, part 2René Scharfe, Sep 27, 2016
  3. Junio C HamanoSep 27, 2016
  4. René ScharfeSep 27, 2016
  5. Jeff KingOct 7, 2016
  6. René ScharfeOct 7, 2016

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.