On Tue, 27 Sep 2005, Ryan Anderson wrote:
git-rev-parse $tagname^0
You need "--verify". Otherwise git-rev-parse will think that you just have
a strange filename or other random thing:
prompt$ git-rev-parse 000^0
000^0
prompt$ git-rev-parse --verify 000^0
fatal: Needed a single revision
Now, if the tag doesn't point to a commit, then the "^0" thing will fail.
What you could use instead is
git-rev-list --max-count=1 "$tag"
since git-rev-list will actually follow the tag. Of course, whether it
does so correctly or not if the tagged object doesn't exist, I dunno.
Testing needed.
Finally, you might just do it by hand
type=$(git-cat-file -t "$obj") || exit
if [ "$type" == "$tag" ]; then
tagged=$(git-cat-file tag "$obj" |
sed 's/object // ; q')
git-rev-parse --verify "$tagged"
fi
untested, of course.
Linus