summaryrefslogtreecommitdiff
path: root/t/t6006-rev-list-format.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-06-16 23:22:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-16 23:22:51 (GMT)
commit799c34449e6e54c7e5fc0c623115ada4c868c64d (patch)
tree132bb32850f2cc54b4995b0f3a8a127354ece43e /t/t6006-rev-list-format.sh
parent318d4013461dbd6fc6bbd05983fc4a9fd5465769 (diff)
parentc197702156e2164074327f5e870ab0d3021977fc (diff)
downloadgit-799c34449e6e54c7e5fc0c623115ada4c868c64d.zip
git-799c34449e6e54c7e5fc0c623115ada4c868c64d.tar.gz
git-799c34449e6e54c7e5fc0c623115ada4c868c64d.tar.bz2
Merge branch 'jn/shortlog' into maint
* jn/shortlog: pretty: Respect --abbrev option shortlog: Document and test --format option t4201 (shortlog): Test output format with multiple authors t4201 (shortlog): guard setup with test_expect_success Documentation/shortlog: scripted users should not rely on implicit HEAD
Diffstat (limited to 't/t6006-rev-list-format.sh')
-rwxr-xr-xt/t6006-rev-list-format.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index a49b7c5..e8fde5c 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -191,6 +191,31 @@ test_expect_success 'add LF before non-empty (2)' '
grep "^$" actual
'
+test_expect_success '--abbrev' '
+ echo SHORT SHORT SHORT >expect2 &&
+ echo LONG LONG LONG >expect3 &&
+ git log -1 --format="%h %h %h" HEAD >actual1 &&
+ git log -1 --abbrev=5 --format="%h %h %h" HEAD >actual2 &&
+ git log -1 --abbrev=5 --format="%H %H %H" HEAD >actual3 &&
+ sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual2 >fuzzy2 &&
+ sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual3 >fuzzy3 &&
+ test_cmp expect2 fuzzy2 &&
+ test_cmp expect3 fuzzy3 &&
+ ! test_cmp actual1 actual2
+'
+
+test_expect_success '%H is not affected by --abbrev-commit' '
+ git log -1 --format=%H --abbrev-commit --abbrev=20 HEAD >actual &&
+ len=$(wc -c <actual) &&
+ test $len = 41
+'
+
+test_expect_success '%h is not affected by --abbrev-commit' '
+ git log -1 --format=%h --abbrev-commit --abbrev=20 HEAD >actual &&
+ len=$(wc -c <actual) &&
+ test $len = 21
+'
+
test_expect_success '"%h %gD: %gs" is same as git-reflog' '
git reflog >expect &&
git log -g --format="%h %gD: %gs" >actual &&
@@ -203,6 +228,12 @@ test_expect_success '"%h %gD: %gs" is same as git-reflog (with date)' '
test_cmp expect actual
'
+test_expect_success '"%h %gD: %gs" is same as git-reflog (with --abbrev)' '
+ git reflog --abbrev=13 --date=raw >expect &&
+ git log -g --abbrev=13 --format="%h %gD: %gs" --date=raw >actual &&
+ test_cmp expect actual
+'
+
test_expect_success '%gd shortens ref name' '
echo "master@{0}" >expect.gd-short &&
git log -g -1 --format=%gd refs/heads/master >actual.gd-short &&