Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit fafd382

Browse files
committed
log-tree: the previous one is still not quite right
The correct output would have NUL after each commit, so "-z --format=%s" would have a single-liner subject with the line-terminating LF replaced with NUL, and "-p/--stat -z --format=%s" would have a single-liner subject with its line-terminating LF, followed by the diff/diffstat in which the terminating LF of the last line is replaced with NUL, but to be consistent with what "-p/--stat -z --pretty=format:%s" does, I think it is OK to append NUL to the diff/diffstat part instead of replacing its last LF with NUL. The added test shows the update is still not right for "-p -z --format". Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3e06530 commit fafd382

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

t/t4205-log-pretty-formats.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,20 @@ test_expect_success 'NUL termination' '
8383
test_cmp expected actual
8484
'
8585

86+
test_expect_success 'NUL separation with --stat' '
87+
stat0_part=$(git diff --stat HEAD^ HEAD) &&
88+
stat1_part=$(git diff --stat --root HEAD^) &&
89+
printf "add bar\n$stat0_part\n\0initial\n$stat1_part\n" >expected &&
90+
git log -z --stat --pretty="format:%s" >actual &&
91+
test_cmp expected actual
92+
'
93+
94+
test_expect_failure 'NUL termination with --stat' '
95+
stat0_part=$(git diff --stat HEAD^ HEAD) &&
96+
stat1_part=$(git diff --stat --root HEAD^) &&
97+
printf "add bar\n$stat0_part\n\0initial\n$stat1_part\n\0" >expected &&
98+
git log -z --stat --pretty="tformat:%s" >actual &&
99+
test_cmp expected actual
100+
'
101+
86102
test_done

0 commit comments

Comments
 (0)