@matheusbsbs / matheus-bagliano / commits / ac52d9410e
Fork 0

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 <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Nov 19, 2019 at 16:51 UTC ac52d9410e5fad8d0bffa95e70e514c3fbd96871
1 file changed +30
t/t4205-log-pretty-formats.sh
+30
@@ -134,6 +134,36 @@ test_expect_failure C_LOCALE_OUTPUT 'NUL termination with --stat' '
134 test_cmp expected actual
135 '
136
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 +
167 test_expect_success 'setup more commits' '
168 test_commit "message one" one one message-one &&
169 test_commit "message two" two two message-two &&