Re: [PATCH/RFC] Add [] as an alias for a reference to the empty tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]