diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-07-18 14:11:35 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-18 15:16:23 -0700 |
commit | 118aa4acff6afae733c206df7049ea54f7e0b282 (patch) | |
tree | 61d76c896c087f7b182ac118b0ecc66c935b9940 /t | |
parent | 45bc950b4330ab675724b5079aa1528acde9f404 (diff) | |
download | git-118aa4acff6afae733c206df7049ea54f7e0b282.tar.gz |
name-rev: differentiate between tags and commits they point at
"git name-rev --stdin" has been fixed to convert an object name that
points at a tag to a refname of the tag. The codepath to handle its
command line arguments, however, fed the commit that the tag points
at to the underlying naming machinery.
With this fix, you will get this:
$ git name-rev --refs=tags/\* --name-only $(git rev-parse v1.8.3 v1.8.3^0)
v1.8.3
v1.8.3^0
which is the same as what you would get from the fixed "--stdin" variant:
$ git rev-parse v1.8.3 v1.8.3^0 | git name-rev --refs=tags/\* --name-only
v1.8.3
v1.8.3^0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t6120-describe.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index a25729f2a7..1d20854609 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -174,4 +174,16 @@ check_describe "test2-lightweight-*" --tags --match="test2-*" check_describe "test2-lightweight-*" --long --tags --match="test2-*" HEAD^ +test_expect_success 'name-rev with exact tags' ' + echo A >expect && + tag_object=$(git rev-parse refs/tags/A) && + git name-rev --tags --name-only $tag_object >actual && + test_cmp expect actual && + + echo "A^0" >expect && + tagged_commit=$(git rev-parse "refs/tags/A^0") && + git name-rev --tags --name-only $tagged_commit >actual && + test_cmp expect actual +' + test_done |