git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 2/3] name-rev: strip trailing ^0 in when --name-only
Date: Sun, 07 Jul 2013 15:03:27 -0700	[thread overview]
Message-ID: <7vtxk62fkg.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7vd2qu44mm.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Sun, 07 Jul 2013 11:16:49 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> WRT "describe --contains", I do agree that both of these
>
>     $ git describe $(git rev-parse v1.8.3^0)
>     $ git describe --contains $(git rev-parse v1.8.3^0)
>         
> should just say "v1.8.3" without ~0/^0/~0~0~0 etc. and the last
> example you showed will be improved by dropping ^0 at the end.
>
> However.
>
> I was a bit bothered by the description talking _only_ about
> describe, but the actual change is to modify what name-rev gives its
> direct users as well.  And that made me realize that the patch
> itself has an undesirable side effect.
>
> "describe" is _only_ about commit history graph, so in its context
> v1.8.3 means the same thing as v1.8.3^0 (we never want to get a tag;
> we always want a commit).  But I do not think "name-rev" is limited
> to commits, in the sense that you would see this:
>
>     $ git rev-parse v1.8.3 v1.8.3^0 | git name-rev --stdin
>     8af06057d0c31a24e8737ae846ac2e116e8bafb9
>     edca4152560522a431a51fc0a06147fc680b5b18 (tags/v1.8.3^0)
>
> The second object is _not_ v1.8.3 but is v1.8.3^0 in the context of
> name-rev, whose purpose is to give you a string you can feed
> "rev-parse" and get the object name back.  "rev-parse v1.8.3" will
> not give you the commit object name, so you need to keep "^0".

Well, the code in "name-rev" other than --stdin mode is already
broken (and the documentation half-describes this breakage) in that
it describes the peeled commit and rejects anything other than
commit objects.  The reason I say "half-describes" is that it only
says that the command takes "commit-ish" and leaves it unclear if it
comes up with a name for the tag itself that happens to be
commit-ish, or it does so for the commit that is referred by the
tag.

I'll send out a WIP to fix that, and also help the topic to strip
unnecessary "^0" suffix when name-rev is run as an implementation
detail of "describe" shortly.

  reply	other threads:[~2013-07-07 22:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-07 12:43 [PATCH 0/3] Iron output of describe --contains --all Ramkumar Ramachandra
2013-07-07 12:43 ` [PATCH 1/3] name-rev: fix assumption about --name-only usage Ramkumar Ramachandra
2013-07-07 18:18   ` Junio C Hamano
2013-07-08 13:18     ` Ramkumar Ramachandra
2013-07-07 12:43 ` [PATCH 2/3] name-rev: strip trailing ^0 in when --name-only Ramkumar Ramachandra
2013-07-07 18:16   ` Junio C Hamano
2013-07-07 22:03     ` Junio C Hamano [this message]
2013-07-08 13:00     ` Ramkumar Ramachandra
2013-07-07 12:43 ` [PATCH 3/3] name-rev doc: rewrite --stdin paragraph Ramkumar Ramachandra
2013-07-07 18:04   ` Junio C Hamano

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7vtxk62fkg.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).