summaryrefslogtreecommitdiff
path: root/t/t4202-log.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-02-08 20:31:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-08 21:39:57 (GMT)
commitf5022b5fedb405c6bbb0b3e7c5a3a7f507279ef5 (patch)
tree3ac438f44e55f7a437531f5f7466c20fbdfb8dd4 /t/t4202-log.sh
parent0202c411edc25940cc381bf317badcdf67670be4 (diff)
downloadgit-f5022b5fedb405c6bbb0b3e7c5a3a7f507279ef5.zip
git-f5022b5fedb405c6bbb0b3e7c5a3a7f507279ef5.tar.gz
git-f5022b5fedb405c6bbb0b3e7c5a3a7f507279ef5.tar.bz2
diff: print line prefix for --name-only output
If you run "git log --graph --name-only", the pathnames are not indented to go along with their matching commits (unlike all of the other diff formats). We need to output the line prefix for each item before writing it. The tests cover both --name-status and --name-only. The former actually gets this right already, because it builds on the --raw format functions. It's only --name-only which uses its own code (and this fix mirrors the code in diff_flush_raw()). Note that the tests don't follow our usual style of setting up the "expect" output inside the test block. This matches the surrounding style, but more importantly it is easier to read: we don't have to worry about embedded single-quotes, and the leading indentation is more obvious. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4202-log.sh')
-rwxr-xr-xt/t4202-log.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 0b53e56..2f8fa4f 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -867,6 +867,54 @@ test_expect_success 'log --graph with diff and stats' '
test_i18ncmp expect actual.sanitized
'
+cat >expect <<-\EOF
+* reach
+|
+| A reach.t
+* Merge branch 'tangle'
+* Merge branch 'side'
+|\
+| * side-2
+|
+| A 2
+* Second
+|
+| A one
+* sixth
+
+ D a/two
+EOF
+
+test_expect_success 'log --graph with --name-status' '
+ git log --graph --format=%s --name-status tangle..reach >actual &&
+ sanitize_output <actual >actual.sanitized &&
+ test_cmp expect actual.sanitized
+'
+
+cat >expect <<-\EOF
+* reach
+|
+| reach.t
+* Merge branch 'tangle'
+* Merge branch 'side'
+|\
+| * side-2
+|
+| 2
+* Second
+|
+| one
+* sixth
+
+ a/two
+EOF
+
+test_expect_success 'log --graph with --name-only' '
+ git log --graph --format=%s --name-only tangle..reach >actual &&
+ sanitize_output <actual >actual.sanitized &&
+ test_cmp expect actual.sanitized
+'
+
test_expect_success 'dotdot is a parent directory' '
mkdir -p a/b &&
( echo sixth && echo fifth ) >expect &&