Skip to content

Commit ac52d94

Browse files
Denton-Lgitster
authored andcommitted
t4205: cover git log --reflog -z blindspot
The test suite does not include any tests where `--reflog` and `-z` are used together in `git log`. Cover this blindspot. Note that the `--pretty=oneline` case is written separately because it follows a slightly different codepath. Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3e8ed3b commit ac52d94

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

t/t4205-log-pretty-formats.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,36 @@ test_expect_failure C_LOCALE_OUTPUT 'NUL termination with --stat' '
134134
test_cmp expected actual
135135
'
136136

137+
for p in short medium full fuller email raw
138+
do
139+
test_expect_success "NUL termination with --reflog --pretty=$p" '
140+
revs="$(git rev-list --reflog)" &&
141+
for r in $revs
142+
do
143+
git show -s "$r" --pretty="$p" &&
144+
printf "\0" || return 1
145+
done >expect &&
146+
{
147+
git log -z --reflog --pretty="$p" &&
148+
printf "\0"
149+
} >actual &&
150+
test_cmp expect actual
151+
'
152+
done
153+
154+
test_expect_success 'NUL termination with --reflog --pretty=oneline' '
155+
revs="$(git rev-list --reflog)" &&
156+
for r in $revs
157+
do
158+
git show -s --pretty=oneline "$r" >raw &&
159+
cat raw | lf_to_nul || exit 1
160+
done >expect &&
161+
# the trailing NUL is already produced so we do not need to
162+
# output another one
163+
git log -z --pretty=oneline --reflog >actual &&
164+
test_cmp expect actual
165+
'
166+
137167
test_expect_success 'setup more commits' '
138168
test_commit "message one" one one message-one &&
139169
test_commit "message two" two two message-two &&

0 commit comments

Comments
 (0)