Jeff King <peff@xxxxxxxx> writes: >> Without this patch, all three give the same result: >> >> $ git describe --exact-match --always HEAD >> fatal: no tag exactly matches '59d18088fe8ace4bf18ade27eeef3664fb6b0878' >> $ git describe --exact-match --candidates=0 HEAD >> fatal: no tag exactly matches '59d18088fe8ace4bf18ade27eeef3664fb6b0878' >> $ git describe --candidates=0 --always HEAD >> fatal: no tag exactly matches '59d18088fe8ace4bf18ade27eeef3664fb6b0878' >> >> With this patch, we instead get this: >> >> $ ./git describe --exact-match --always HEAD >> 59d18088fe >> $ ./git describe --exact-match --candidates=0 HEAD >> fatal: No tags can describe '59d18088fe8ace4bf18ade27eeef3664fb6b0878'. >> Try --always, or create some tags. >> $ ./git describe --candidates=0 --always HEAD >> 59d18088fe > ... > I think there are really two questions here: > > 1. Is the current behavior of "describe --exact-match --always" a bug? > I'll grant that probably nobody cares deeply, which is why the > interaction has not been noticed for all of these years. I think > the semantics this patch gives are the only ones that make sense, > but I also don't care that deeply. But... > > 2. What should we do about the new regression caused by limiting the > candidate list? Ahh, OK, these --candidate=0 / --exact-match were for illustration purposes only. The real issue is that the user does not, with $ git describe --always HEAD ask for exact matches only at all, but we internally pretend as if they did, which is not nice. My gut reaction is that it is wrong not to give the abbreviated object name in this case, but the price to do so shouldn't be to change the behaviour when --exact-match was requested the the user. Loosening the interaction between the two options, when both were given explicitly, may be an improvement, but I think that should be treated as a separate topic, with its merit justified independently, since the command has been behaving this way from fairly early version, possibly the one that had both of the options for the first time. $ rungit v2.20.0 describe --exact-match HEAD fatal: No names found, cannot describe anything. $ rungit v2.20.0 describe --exact-match --always HEAD fatal: no tag exactly matches '13a3dd7fe014658da465e9621ec3651f5473041e' $ rungit v2.20.0 describe --exact-match --candidate=0 HEAD fatal: No names found, cannot describe anything. Thanks.