diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-07-18 14:46:51 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-18 15:16:23 -0700 |
commit | adfc1857bdb090786fd9d22c1acec39371c76048 (patch) | |
tree | 2f0fb03ae59fac4c1495ace15b24e1fba14f9944 /t | |
parent | 118aa4acff6afae733c206df7049ea54f7e0b282 (diff) | |
download | git-adfc1857bdb090786fd9d22c1acec39371c76048.tar.gz |
describe: fix --contains when a tag is given as inputjc/name-rev-exact-ref
"git describe" takes a commit and gives it a name based on tags in
its neighbourhood. The command does take a commit-ish but when
given a tag that points at a commit, it should dereference the tag
before computing the name for the commit.
As the whole processing is internally delegated to name-rev, if we
unwrap tags down to the underlying commit when invoking name-rev, it
will make the name-rev issue an error message based on the unwrapped
object name (i.e. either 40-hex object name, or "$tag^0") that is
different from what the end-user gave to the command when the commit
cannot be described. Introduce an internal option --peel-tag to the
name-rev to tell it to unwrap a tag in its input from the command
line.
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 1d20854609..c0e5b2a627 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -186,4 +186,16 @@ test_expect_success 'name-rev with exact tags' ' test_cmp expect actual ' +test_expect_success 'describe --contains with the exact tags' ' + echo "A^0" >expect && + tag_object=$(git rev-parse refs/tags/A) && + git describe --contains $tag_object >actual && + test_cmp expect actual && + + echo "A^0" >expect && + tagged_commit=$(git rev-parse "refs/tags/A^0") && + git describe --contains $tagged_commit >actual && + test_cmp expect actual +' + test_done |