]> git.ipfire.org Git - thirdparty/git.git/commit - object-name.c
object-name: iterate ambiguous objects before showing header
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Thu, 27 Jan 2022 05:26:48 +0000 (06:26 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 27 Jan 2022 20:09:34 +0000 (12:09 -0800)
commitd2ef3cb7e29c35362125a61f1d96576c200076f6
tree3107566e1793e7c8ecd773214a132aab1ce2af41
parent851b3d7671778b74e40bf155c49f6b045f5eb4df
object-name: iterate ambiguous objects before showing header

Change the "The candidates are" header that's shown for ambiguous
objects to be shown after we've iterated over all of the objects.

If we get any errors while doing so we don't want to split up the the
header and the list as a result. The two will now be printed together,
as shown in the updated testcase.

As we're accumulating the lines into as "struct strbuf" before
emitting them we need to add a trailing newline to the call in
show_ambiguous_object(). This and the change from "The candidates
are:" to "The candidates are:\n%s" helps to give translators more
context.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
object-name.c
t/t1512-rev-parse-disambiguation.sh