From: Jeff King <peff@peff.net>
To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC] Add [] as an alias for a reference to the empty tree
Date: Sat, 8 May 2010 00:53:20 -0400 [thread overview]
Message-ID: <20100508045319.GD14998@coredump.intra.peff.net> (raw)
In-Reply-To: <1273250247-20762-1-git-send-email-pkj@axis.com>
On Fri, May 07, 2010 at 06:37:27PM +0200, Peter Kjellerstedt wrote:
> Instead of specifying the SHA1 for the empty tree (i.e.,
> 4b825dc642cb6eb9a060e54bf8d69288fbee4904) one can now say [], e.g.,
> 'git diff [] v1.7.1' would give all the changes between the empty tree
> and the tag v1.7.1.
FWIW, I like the idea of a special namespace that indicates "this is not
a regular ref, but you can resolve it to some object". It seems to come
up once in a while, but I don't recall anybody ever actually making a
patch.
> The rationale for selecting [] as the alias for the empty tree was that
> it looks empty, the brackets are not used for anything related to
> references (AFAIK), they are not allowed in references according to
> 'man git-check-ref-format', and the syntax can easily be extended to
> allow other types of references by adding information between the
> brackets.
I am a little iffy on brackets, as they can invoke shell wildcarding
behavior. But the fact that they don't cause a syntactic conflict does
make them appealing.
Based on past discussions, I suspect other people would be interested
in:
$ git diff [index] HEAD
$ git diff HEAD [index]
$ git diff [working-tree] [index]
etc. I don't think I would want to type those all the time, but they
conceptually are quite clear about what is happening, so they may be
nice for showing new users what is happening with each diff invocation
(as opposed to, say, "git diff --cached" versus "git diff", which is
somewhat unintuitive, even though it is more handy in practice).
-Peff
next prev parent reply other threads:[~2010-05-08 4:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 16:37 [PATCH/RFC] Add [] as an alias for a reference to the empty tree Peter Kjellerstedt
2010-05-08 4:53 ` Jeff King [this message]
2010-05-08 5:24 ` Junio C Hamano
2010-05-08 5:34 ` Jeff King
2010-05-08 16:07 ` Jonathan Nieder
2010-05-10 8:14 ` Peter Kjellerstedt
2010-05-10 9:20 ` Jeff King
2010-05-10 9:51 ` Sverre Rabbelier
2010-05-10 10:00 ` Jeff King
2010-05-10 11:00 ` Sverre Rabbelier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100508045319.GD14998@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=peter.kjellerstedt@axis.com \
/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.
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 NNTP newsgroup(s).