RE: Any way to get complete diff up to a tag?

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

 




On Thu, 6 May 2010, Peter Kjellerstedt wrote:
> 
> Since the 4b825dc642cb6eb9a060e54bf8d69288fbee4904 SHA1 is somewhat
> cumbersome to remember, wouldn't it be an idea to give it some kind 
> of alias or mnemonic? E.g., something like @~ (or some other mix of 
> odd characters which do not clash with all the other similar 
> constructs already used for references).

Well, you don't strictly speaking have to "remember" it, you can always 
just re-generate it. The most straightforward way to do that is probably

	git hash-object -t tree --stdin < /dev/null

although I admit that maybe we could have some syntax for "git diff" that 
would do the "diff against empty tree" automatically. It does seem to be 
conceptually a reasonable thing to do.

For example, right now if you give "git diff" a single SHA1, it will work 
against the working tree. Except if you add "--cached", to say that you 
want the diff against the index. I don't think it would be in any way 
_wrong_ to make "--root" mean that you want it against an empty tree.

[ We already accept "--root", but it has no meaning for "git diff" with a 
  single SHA1. It matters for showing the root commit for 'git-diff-tree'.

  And means something totally different for git-format-patch ]

So we certainly _could_ do something like

	git diff --root <treeish>

and make it do what you want. That said, the "empty tree" thing works for 
all versions of git (well, some older versions of git need the actual 
object, but you could always use "-w" on that git-hash-object command 
line, and then it really should work for every git version).

			Linus
--
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]