Jeff King <> writes:

> Although I am still not clear on why it would not be up to the caller of
> git-describe in the first place to decide which they wanted.

Thanks for a dose of sanity.

Even though the part of the miniseries that makes sure that "X (Y)"
output from "name-rev" always satisfies that "rev-parse" on X and Y
give the same thing is an improvement, the whole thing about
"describe" is misguided and wrong, I think.

It started from the observation that these do not match:

    $ git describe $(git rev-parse v1.8.3)
    $ git describe --contains $(git rev-parse v1.8.3)

and the miniseries veered in a wrong direction of "fixing" the
latter to match the former.

But the thing is, what is incosistent from the rest of the world is
the describe output without "--contains" for a commit that is
exactly at a tag (i.e. the former), and there is no need to "fix"
this "inconsistency", as we see below.

The form without "--contains" in general reads like this:

    $ git describe --long $(git rev-parse v1.8.3) a717d9e

They both name a commit object, but that is sort of an afterthought;
the support for describe name came late at 7dd45e15 (sha1_name.c:
understand "describe" output as a valid object name, 2006-09-20).

The primary purpose of "git describe" without "--contains" is to
give a string that is suitable for a version number to be embedded
in an executable.  For that purpose, "v1.8.3" is more convenient
than "v1.8.3-0-gedca415".

But this convenient format breaks the consistency.  While any other
describe name for a commmit names a commit, the output for a commit
that is exactly at a tag does not (in ancient times, describe output
were not even extended SHA-1 expressions, so this inconsistency did
not matter, but the "afterthought" brought the consistency to the
foreground).  The user chooses the convenience over the consistency
by not using "--long".

And the short form cannot be "v1.8.3^0" or "v1.8.3~0" for the sake of
"consistency", as these are no more suitable as a version number
than a short and sweet "v1.8.3".

The "--contains" form does not even aim to come up with a pleasant
looking version string without using funny line noise characters, so
it is perfectly fine for it to say:

    $ git describe --contains $(git rev-parse v1.8.3) a717d9e

and these are internally consistent (they both roundtrip via
rev-parse).  Stripping "^0" from the former will break the
consistency, even though it may make the output look prettier, but
the "--contains" output is not even meant to be "pretty" in the
first place.

So let's drop 4/4; it is breaking the system by trying to solve a
problem that does not exist.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to