t1400: set core.logAllRefUpdates in "logged by touch" tests

A group of update-ref tests verifies that logs are created when either the log file for the ref already exists or core.logAllRefUpdates is "true". However, when the default for core.logAllRefUpdates was changed in 0bee59186 (Enable reflogs by default in any repository with a working directory., 2006-12-14), the setup for the tests was not updated. As a result, the "logged by touch" tests would pass even if the log file did not exist (i.e., if "--create-reflog" was removed from the first "git update-ref" call). Update the "logged by touch" tests to disable core.logAllRefUpdates explicitly so that the behavior does not depend on the default value. While we're here, update the "logged by config" tests to use test_config() rather than setting core.logAllRefUpdates to "true" outside of the tests. Signed-off-by: Kyle Meyer <kyle@kyleam.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kyle Meyer committed Mar 20, 2017 at 20:56 UTC 3e5584ca61efbcc99f2c043cfd0b3cff76ca786d
1 file changed +12 -11
t/t1400-update-ref.sh
+12 -11
@@ -260,17 +260,20 @@ rm -f .git/$m
260 rm -f .git/logs/refs/heads/master
261 test_expect_success \
262 "create $m (logged by touch)" \
263 - 'GIT_COMMITTER_DATE="2005-05-26 23:30" \
263 + 'test_config core.logAllRefUpdates false &&
264 + GIT_COMMITTER_DATE="2005-05-26 23:30" \
265 git update-ref --create-reflog HEAD '"$A"' -m "Initial Creation" &&
266 test '"$A"' = $(cat .git/'"$m"')'
267 test_expect_success \
268 "update $m (logged by touch)" \
268 - 'GIT_COMMITTER_DATE="2005-05-26 23:31" \
269 + 'test_config core.logAllRefUpdates false &&
270 + GIT_COMMITTER_DATE="2005-05-26 23:31" \
271 git update-ref HEAD'" $B $A "'-m "Switch" &&
272 test '"$B"' = $(cat .git/'"$m"')'
273 test_expect_success \
274 "set $m (logged by touch)" \
273 - 'GIT_COMMITTER_DATE="2005-05-26 23:41" \
275 + 'test_config core.logAllRefUpdates false &&
276 + GIT_COMMITTER_DATE="2005-05-26 23:41" \
277 git update-ref HEAD'" $A &&
278 test $A"' = $(cat .git/'"$m"')'
279
@@ -311,24 +314,22 @@ test_expect_success \
314 "test_cmp expect .git/logs/$m"
315 rm -rf .git/$m .git/logs expect
316
314 -test_expect_success \
315 - 'enable core.logAllRefUpdates' \
316 - 'git config core.logAllRefUpdates true &&
317 - test true = $(git config --bool --get core.logAllRefUpdates)'
318 -
317 test_expect_success \
318 "create $m (logged by config)" \
321 - 'GIT_COMMITTER_DATE="2005-05-26 23:32" \
319 + 'test_config core.logAllRefUpdates true &&
320 + GIT_COMMITTER_DATE="2005-05-26 23:32" \
321 git update-ref HEAD'" $A "'-m "Initial Creation" &&
322 test '"$A"' = $(cat .git/'"$m"')'
323 test_expect_success \
324 "update $m (logged by config)" \
326 - 'GIT_COMMITTER_DATE="2005-05-26 23:33" \
325 + 'test_config core.logAllRefUpdates true &&
326 + GIT_COMMITTER_DATE="2005-05-26 23:33" \
327 git update-ref HEAD'" $B $A "'-m "Switch" &&
328 test '"$B"' = $(cat .git/'"$m"')'
329 test_expect_success \
330 "set $m (logged by config)" \
331 - 'GIT_COMMITTER_DATE="2005-05-26 23:43" \
331 + 'test_config core.logAllRefUpdates true &&
332 + GIT_COMMITTER_DATE="2005-05-26 23:43" \
333 git update-ref HEAD '"$A &&
334 test $A"' = $(cat .git/'"$m"')'
335