Re: [PATCH 2/2] use strbuf_add_unique_abbrev() for adding short hashes, part 2
- From
René Scharfe <l.s.r@web.de>
- Date
- Sep 27, 2016, 20:59 UTC
- Message-ID
- <3c80f7d7-a145-3a4a-4bf2-2d8fb6dda04b@web.de>
- In-Reply-To
- <xmqqshslm6jo.fsf@gitster.mtv.corp.google.com>
Am 27.09.2016 um 22:28 schrieb Junio C Hamano:
Show 19 quoted lines
> René Scharfe <l.s.r@web.de> writes: >> 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);
Impossible. I added "->hash" manually during a rebase (merging a0d12c44, wrongly). Good catch, thanks!
Seeing proof of skipping compile-testing I wonder what else I do forget in my daily life. :-| I'll better go to sleep now..
Fixup patch, generated by reverting the diff, re-adding the semantic patch and using coccicheck; compiles and survives make test: --- submodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/submodule.c b/submodule.c index 8cf40ea..bb06b60 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_add_unique_abbrev(&sb->hash, two, DEFAULT_ABBREV); + strbuf_add_unique_abbrev(&sb, two->hash, DEFAULT_ABBREV); if (message) strbuf_addf(&sb, " %s%s\n", message, reset); else
-- 2.10.0