Skip to content

Commit d52a45c

Browse files
committed
Merge branch 'ks/t4205-test-describe-with-abbrev-fix'
Test update. * ks/t4205-test-describe-with-abbrev-fix: t4205: correctly test %(describe:abbrev=...)
2 parents 061c586 + 1876a5a commit d52a45c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

t/t4205-log-pretty-formats.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,10 +1012,25 @@ test_expect_success '%(describe:tags) vs git describe --tags' '
10121012

10131013
test_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

10211036
test_expect_success 'log --pretty with space stealing' '

0 commit comments

Comments
 (0)