author | Linus Torvalds <torvalds@g5.osdl.org> | |
Tue, 12 Jul 2005 01:27:25 +0000 (18:27 -0700) | ||
committer | Linus Torvalds <torvalds@g5.osdl.org> | |
Tue, 12 Jul 2005 01:27:25 +0000 (18:27 -0700) | ||
commit | 79162bb8ad43aefb23172b9f164ea13ac2b60744 | |
tree | 411e665b69eef158141fe511470c6f724ed4bee8 | tree | snapshot |
parent | e33b2ef8f59a136402ae434cc743408300d69e9a | commit | diff |
git-rev-parse: Allow a "zeroth" parent of a commit - the commit itself.
This sounds nonsensical, but it's useful to make sure that the result is
a commit.
For example, "git-rev-parse v2.6.12" will return the _tag_ object for
v2.6.12, but "git-rev-parse v2.6.12^0" will return the _commit_ object
associated with that tag (and v2.6.12^1 will return the first parent).
Also, since the "parent" code will actually parse the commit, this,
together with the "--verify" flag, will verify not only that the result
is a single SHA1, but will also have verified that it's a proper commit
that we can see.
This sounds nonsensical, but it's useful to make sure that the result is
a commit.
For example, "git-rev-parse v2.6.12" will return the _tag_ object for
v2.6.12, but "git-rev-parse v2.6.12^0" will return the _commit_ object
associated with that tag (and v2.6.12^1 will return the first parent).
Also, since the "parent" code will actually parse the commit, this,
together with the "--verify" flag, will verify not only that the result
is a single SHA1, but will also have verified that it's a proper commit
that we can see.
rev-parse.c | diff | blob | history |