summaryrefslogtreecommitdiffstats
path: root/t/t4205-log-pretty-formats.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-01-29 12:47:56 -0800
committerJunio C Hamano <gitster@pobox.com>2019-01-29 12:47:57 -0800
commita562a119833b7202d5c9b9069d1abb40c1f9b59a (patch)
tree9e2e07ce274b0a5a070d837c865f6844b1dc0de8 /t/t4205-log-pretty-formats.sh
parent7fa92ba40abbe4236226e7d91e664bbeab8c43f2 (diff)
parentad6f028f067673cadadbc2219fcb0bb864300a6c (diff)
downloadgit-a562a119833b7202d5c9b9069d1abb40c1f9b59a.tar.gz
git-a562a119833b7202d5c9b9069d1abb40c1f9b59a.tar.xz
Merge branch 'it/log-format-source'
Custom userformat "log --format" learned %S atom that stands for the tip the traversal reached the commit from, i.e. --source. * it/log-format-source: log: add %S option (like --source) to log --format
Diffstat (limited to 't/t4205-log-pretty-formats.sh')
-rwxr-xr-xt/t4205-log-pretty-formats.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 978a8a66f..7df8c3d4e 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -621,4 +621,54 @@ test_expect_success 'trailer parsing not fooled by --- line' '
test_cmp expect actual
'
+test_expect_success 'set up %S tests' '
+ git checkout --orphan source-a &&
+ test_commit one &&
+ test_commit two &&
+ git checkout -b source-b HEAD^ &&
+ test_commit three
+'
+
+test_expect_success 'log --format=%S paints branch names' '
+ cat >expect <<-\EOF &&
+ source-b
+ source-a
+ source-b
+ EOF
+ git log --format=%S source-a source-b >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'log --format=%S paints tag names' '
+ git tag -m tagged source-tag &&
+ cat >expect <<-\EOF &&
+ source-tag
+ source-a
+ source-tag
+ EOF
+ git log --format=%S source-tag source-a >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'log --format=%S paints symmetric ranges' '
+ cat >expect <<-\EOF &&
+ source-b
+ source-a
+ EOF
+ git log --format=%S source-a...source-b >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '%S in git log --format works with other placeholders (part 1)' '
+ git log --format="source-b %h" source-b >expect &&
+ git log --format="%S %h" source-b >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '%S in git log --format works with other placeholders (part 2)' '
+ git log --format="%h source-b" source-b >expect &&
+ git log --format="%h %S" source-b >actual &&
+ test_cmp expect actual
+'
+
test_done