list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <>
To: Jeff King <>
Subject: Re: [PATCH 4/4] describe/name-rev: tell name-rev to peel the incoming object to commit first
Date: Tue, 09 Jul 2013 04:45:39 -0700	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <> (Jeff King's message of "Tue, 9 Jul 2013 01:35:33 -0400")

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.

  reply	other threads:[~2013-07-09 11:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-07 22:33 [PATCH 0/4] Make "git name-rev $(git rev-parse v1.8.3)" work Junio C Hamano
2013-07-07 22:33 ` [PATCH 1/4] name-ref: factor out name shortening logic from name_ref() Junio C Hamano
2013-07-08  8:52   ` Michael Haggerty
2013-07-08 15:04     ` Junio C Hamano
2013-07-07 22:33 ` [PATCH 2/4] name-rev: allow converting the exact object name at the tip of a ref Junio C Hamano
2013-07-08 12:20   ` Ramkumar Ramachandra
2013-07-08 15:12     ` Junio C Hamano
2013-07-07 22:33 ` [PATCH 3/4] describe: use argv-array Junio C Hamano
2013-07-09  4:51   ` Jeff King
2013-07-09 14:55     ` Junio C Hamano
2013-07-09 16:00       ` Junio C Hamano
2013-07-09 18:53         ` Jeff King
2013-07-07 22:33 ` [PATCH 4/4] describe/name-rev: tell name-rev to peel the incoming object to commit first Junio C Hamano
2013-07-08 13:08   ` Ramkumar Ramachandra
2013-07-09  5:12     ` Jeff King
2013-07-09  5:06   ` Jeff King
2013-07-09  5:33     ` Junio C Hamano
2013-07-09  5:35       ` Jeff King
2013-07-09 11:45         ` Junio C Hamano [this message]
2013-07-09 12:42           ` Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \
    --subject='Re: [PATCH 4/4] describe/name-rev: tell name-rev to peel the incoming object to commit first' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).