On Wed, Dec 04, 2024 at 06:27:50PM -0500, Jeff King wrote: > > - if (!max_candidates) > > + if (!max_candidates && !always) > > die(_("no tag exactly matches '%s'"), oid_to_hex(&cmit->object.oid)); > > if (debug) > > fprintf(stderr, _("No exact match on refs or tags, searching to describe\n")); > > Yep, this is the same spot I found. I think it's the right place to make > the fix. > > > Subject: Re: [PATCH] fixup! describe: stop traversing when we run out of names > > This commit is already in 'next', so it's too late to squash in a change > (though I'd have done this separately anyway, as it's already an issue > for a manual --candidates=0 setting, as unlikely as that is). > > Can you re-send with a full commit message? In case it helps with writing a commit message: I wondered why this line was there at all. It comes from 2c33f75754 (Teach git-describe --exact-match to avoid expensive tag searches, 2008-02-24). The --exact-match option is implemented by setting max-candidates to 0. So: git describe --exact-match --always has always been broken, but probably nobody ever cared. My series reduces the max_candidates setting automatically when there is nothing to find, which means you are more likely to hit the bug. -Peff