Thread (8 messages) flat view 8 messages, 5 authors, 2016-06-15

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

From: Peter Kjellerstedt <hidden>
Date: 2016-06-15 22:48:47

-----Original Message-----
From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On
Behalf Of Junio C Hamano
Sent: den 8 maj 2010 07:25
To: Jeff King
Cc: Peter Kjellerstedt; git@vger.kernel.org
Subject: Re: [PATCH/RFC] Add [] as an alias for a reference to the
empty tree

Jeff King [off-list ref] writes:
quoted
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]
Interesting. I had not thought of that, but I can see the use for it
in some situations if nothing else but to clarify what is going on.
quoted
etc. I don't think I would want to type those all the time,...
Well, I have to agree on that, even though I guess they could be 
abbreviated like [i] and [wt].
If you go that route, why not use INDEX and WORKTREE (all caps) to at
least avoid the brackets?  I am not personally interested in [] at all,
but as part of that repertoire of syntactic sugar tokens EMPTY might be
able to sneak in [*1*]
The reason I choose to use some special characters like [] was that I 
explicitly did not want to touch the normal namespace for references,
since these refs do not actually exist in the .git directory and things
could get a bit surprising if someone actually created a branch/tag
named INDEX...

However, if INDEX, WORKTREE and EMPTY are preferred as syntactic sugar
tokes, then that is fine by me. Unfortunately, I do not have the time
nor the knowledge needed to add support for the INDEX and WORKTREE 
tokens, so I am afraid I will have to leave this as a suggestion for 
the future.
[Footnote]

*1* Without that "[]" syntax, the feature is "Meh" for me, but with the
syntax, it becomes "Yuck".  The reason I am not interested in the
feature is because I don't see much value in running "git diff EMPTY
<anything>". Perhaps "git archive" might be what the user really wants 
to find.
As I mentioned in [1] I am post-processing the generated diff, and then 
the empty tree is just another starting point for the diff. Having to 
get the full content some other way (e.g., via git archive) would just
mean a lot of unnecessary code and special casing in this case.

//Peter

[1] http://thread.gmane.org/gmane.comp.version-control.git/146468/focus=146518
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help