diff options
author | Linus Torvalds <torvalds@osdl.org> | 2006-04-18 16:45:16 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-04-18 21:52:41 -0700 |
commit | 5119602a99f46aaa7b3bb2a0f5085b1df46b54ec (patch) | |
tree | 54cecf3fabe7cd2e187fd837df66a4a9963b2831 /index-pack.c | |
parent | Fix uninteresting tags in new revision parsing (diff) | |
download | tgif-5119602a99f46aaa7b3bb2a0f5085b1df46b54ec.tar.xz |
get_sha1() shorthands for blob/tree objects
This is a fairly straightforward patch to allow "get_sha1()" to also have
shorthands for tree and blob objects.
The syntax is very simple and intuitive: you can specify a tree or a blob
by simply specifying <revision>:<path>, and get_sha1() will do the SHA1
lookup from the tree for you.
You can currently do it with "git ls-tree <rev> <path>" and parsing the
output, but that's actually pretty awkward.
With this, you can do something like
git cat-file blob v1.2.4:Makefile
to get the contents of "Makefile" at revision v1.2.4.
Now, this isn't necessarily something you really need all that often, but
the concept itself is actually pretty powerful. We could, for example,
allow things like
git diff v0.99.6:git-commit-script..v1.3.0:git-commit.sh
to see the difference between two arbitrary files in two arbitrary
revisions. To do that, the only thing we'd have to do is to make
git-diff-tree accept two blobs to diff, in addition to the two trees it
now expects.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'index-pack.c')
0 files changed, 0 insertions, 0 deletions