Skip to content

Commit 667a560

Browse files
avargitster
authored andcommitted
object-name: explicitly handle bad tags in show_ambiguous_object()
Follow-up the handling of OBJ_BAD in the preceding commit and explicitly handle those cases where parse_tag() fails, or we don't end up with a non-NULL pointer in in tag->tag. If we run into such a tag we'd previously be silent about it. We really should also be handling these batter in parse_tag_buffer() by being more eager to emit an error(), instead of silently aborting with "return -1;". One example of such a tag is the one that's tested for in "t3800-mktag.sh", where the code takes the "size < the_hash_algo->hexsz + 24" branch. But in lieu of earlier missing "error" output let's show the user something to indicate why we're not showing a tag message in these cases, now instead of showing: hint: deadbee tag We'll instead display: hint: deadbee tag [tag could not be parsed] Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6780e68 commit 667a560

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

object-name.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
382382
struct tag *tag = lookup_tag(ds->repo, oid);
383383
if (!parse_tag(tag) && tag->tag)
384384
strbuf_addf(&desc, " %s", tag->tag);
385+
else
386+
strbuf_addstr(&desc, " [tag could not be parsed]");
385387
}
386388

387389
out:

0 commit comments

Comments
 (0)