File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1012,10 +1012,25 @@ test_expect_success '%(describe:tags) vs git describe --tags' '
10121012
10131013test_expect_success ' %(describe:abbrev=...) vs git describe --abbrev=...' '
10141014 test_when_finished "git tag -d tagname" &&
1015+
1016+ # Case 1: We have commits between HEAD and the most recent tag
1017+ # reachable from it
1018+ test_commit --no-tag file &&
1019+ git describe --abbrev=15 >expect &&
1020+ git log -1 --format="%(describe:abbrev=15)" >actual &&
1021+ test_cmp expect actual &&
1022+
1023+ # Make sure the hash used is at least 15 digits long
1024+ sed -e "s/^.*-g\([0-9a-f]*\)$/\1/" <actual >hexpart &&
1025+ test 16 -le $(wc -c <hexpart) &&
1026+
1027+ # Case 2: We have a tag at HEAD, describe directly gives the
1028+ # name of the tag
10151029 git tag -a -m tagged tagname &&
10161030 git describe --abbrev=15 >expect &&
10171031 git log -1 --format="%(describe:abbrev=15)" >actual &&
1018- test_cmp expect actual
1032+ test_cmp expect actual &&
1033+ test tagname = $(cat actual)
10191034'
10201035
10211036test_expect_success ' log --pretty with space stealing' '
You can’t perform that action at this time.
0 commit comments