aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-07-08 11:23:07 -0700
committerJunio C Hamano <gitster@pobox.com>2023-07-08 11:23:07 -0700
commitd52a45cf5635f9f40a99ddc6efa92713f2d357b4 (patch)
tree5d5d64738116d675e36ab96a50a88a7dfeb11bbf
parentThe eighth batch (diff)
parentt4205: correctly test %(describe:abbrev=...) (diff)
downloadgit-d52a45cf5635f9f40a99ddc6efa92713f2d357b4.tar.gz
git-d52a45cf5635f9f40a99ddc6efa92713f2d357b4.zip
Merge branch 'ks/t4205-test-describe-with-abbrev-fix'
Test update. * ks/t4205-test-describe-with-abbrev-fix: t4205: correctly test %(describe:abbrev=...)
-rwxr-xr-xt/t4205-log-pretty-formats.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 4cf8a77667..dd9035aa38 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -1012,10 +1012,25 @@ test_expect_success '%(describe:tags) vs git describe --tags' '
test_expect_success '%(describe:abbrev=...) vs git describe --abbrev=...' '
test_when_finished "git tag -d tagname" &&
+
+ # Case 1: We have commits between HEAD and the most recent tag
+ # reachable from it
+ test_commit --no-tag file &&
+ git describe --abbrev=15 >expect &&
+ git log -1 --format="%(describe:abbrev=15)" >actual &&
+ test_cmp expect actual &&
+
+ # Make sure the hash used is at least 15 digits long
+ sed -e "s/^.*-g\([0-9a-f]*\)$/\1/" <actual >hexpart &&
+ test 16 -le $(wc -c <hexpart) &&
+
+ # Case 2: We have a tag at HEAD, describe directly gives the
+ # name of the tag
git tag -a -m tagged tagname &&
git describe --abbrev=15 >expect &&
git log -1 --format="%(describe:abbrev=15)" >actual &&
- test_cmp expect actual
+ test_cmp expect actual &&
+ test tagname = $(cat actual)
'
test_expect_success 'log --pretty with space stealing' '