Subject: Re: [PATCH] describe: make '--always' fallback work after '--exact-match' failed

From: Junio C Hamano <[email-masked]>
Date: Fri, 21 Aug 2015 08:55:32 -0700

SZEDER Gábor <[email-masked]> writes:

> Quoting Junio C Hamano <[email-masked]>:
>
>> Well, that can be argued both ways.
> ...
>
> 'git describe' errors out by default if it can't describe the given
> commit.

Yes.  "describe" always fails when it cannot produce an acceptable
description.

And "--always" and "--exact-match" are two incompatible ways for
users to change what is considered an acceptable description.

 - With "--exact-match" and "--always", the definition of
   "acceptable" changes: by default, only a name based on some
   anchor point is acceptable.

   - "--always" loosens the definition and also allows an
     abbreviated commit object name as acceptable.

   - "--exact-match" tightens the definition.  In addition to "only
     a name based on some anchor point is acceptable", it requires
     that "based on" to be "0 distance from the anchor point".  The
     help text says succinctly: "*ONLY* output exact matches".

If you allow a request with "--exact-match" to show something that
is not an exact match, that no longer is "--exact-match".  Allowing
to mix "--always" to that option breaks it, as what the command does
no longer is to "only outputs exact matches".

 - One option "--exact-match" says that it is wrong to show anything
   but exact matches.

 - The other option "--always" says it is willing to show a name
   that is not an exact match.  

These are competing goals.  You give preference to the latter, but
that is not the only valid point of view.

And that is why I said it can be argued both ways.  I think these
two are fundamentally incompatible.

[Footnote]

*1* Other parts of "'describe' only considers a name based on some
    anchor point as acceptable." are also modified by various
    options:

    - With "--contains", the definition of "based on" changes
      direction: a commit may be described as somewhere ahead of an
      anchor point by default, but can be described as somewhere behind
      of an anchor point.

    - With "--all" and "--tags", the definition of "anchor point"
      changes: by default, only annotated tags are possible anchor
      points.