git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 4/4] describe/name-rev: tell name-rev to peel the incoming object to commit first
Date: Tue, 9 Jul 2013 01:06:15 -0400	[thread overview]
Message-ID: <20130709050615.GF27903@sigill.intra.peff.net> (raw)
In-Reply-To: <1373236424-25617-5-git-send-email-gitster@pobox.com>

On Sun, Jul 07, 2013 at 03:33:44PM -0700, Junio C Hamano wrote:

> With this on top of the other patches in this series, you would get:
> 
>     $ git describe --contains $(git rev-parse v1.8.3 v1.8.3^0)
>     v1.8.3
>     v1.8.3
> 
> while you can still differentiate tags and the commits they point at
> with:
> 
>     $ git name-rev --refs=tags/\* --name-only $(git rev-parse v1.8.3 v1.8.3^0)
>     v1.8.3
>     v1.8.3^0
> 
> The difference in these two behaviours is achieved by adding --peel-to-commit
> option to "name-rev" and using it when "describe" internally calls it.

I am somewhat mixed on this.

You are changing the default behavior of name-rev and adding a new
option to restore it, so I wonder who (if anyone) might be broken. The
documentation is now also out of date; not only does it not mention
"peel-to-commit", but it claims the argument to name-rev is a
committish, which is not really true without that option.

On the other hand, the new default behavior seems way more sane to me.
In general, I would expect name-rev to:

  1. Behave more or less the same between "git name-rev $sha1" and "echo
     $sha1 | git name-rev --stdin". Your patch improves that. Though I
     note that --peel-to-commit does not affect --stdin at all. Should
     it? And of course the two differ in that the command line will take
     any rev-parse expression, and --stdin only looks for full sha1s.

  2. If name-rev prints "$X $Y", I would expect "git rev-parse $X" to
     equal "git rev-parse $Y". With peeling, that is not the case, and
     you get the misleading example that Ram showed:

       $ git name-rev 8af0605
       8af0605 tags/v1.8.3^0

    or more obviously weird:

       $ git name-rev v1.8.3
       v1.8.3 tags/v1.8.3^0

So I think your series moves in a good direction, but I would just worry
that it is breaking backwards compatibility (but like I said, I am not
clear on who is affected and what it means for them).

-Peff

  parent reply	other threads:[~2013-07-09  5:06 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 [this message]
2013-07-09  5:33     ` Junio C Hamano
2013-07-09  5:35       ` Jeff King
2013-07-09 11:45         ` Junio C Hamano
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:
  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=20130709050615.GF27903@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --subject='Re: [PATCH 4/4] describe/name-rev: tell name-rev to peel the incoming object to commit first' \
    /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

Code repositories for project(s) associated with this 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).