Add "get_sha1()" helper function.

This allows the programs to use various simplified versions of
the SHA1 names, eg just say "HEAD" for the SHA1 pointed to by
the .git/HEAD file etc.

For example, this commit has been done with

	git-commit-tree $(git-write-tree) -p HEAD

instead of the traditional "$(cat .git/HEAD)" syntax.
This commit is contained in:
Linus Torvalds
2005-05-01 16:36:56 -07:00
parent 68849b5442
commit 3c249c9506
16 changed files with 46 additions and 16 deletions

View File

@ -58,8 +58,8 @@ int main(int argc, char **argv)
unsigned char rev1key[20], rev2key[20];
if (argc != 3 ||
get_sha1_hex(argv[1], rev1key) ||
get_sha1_hex(argv[2], rev2key)) {
get_sha1(argv[1], rev1key) ||
get_sha1(argv[2], rev2key)) {
usage("merge-base <commit-id> <commit-id>");
}
rev1 = lookup_commit(rev1key);