From: Kyle Meyer Date: Tue, 21 Mar 2017 00:56:13 +0000 (-0400) Subject: t1400: set core.logAllRefUpdates in "logged by touch" tests X-Git-Tag: v2.13.0-rc0~66^2~3 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/3e5584ca61efbcc99f2c043cfd0b3cff76ca786d?hp=f950e89fc4f8e535aa1b8d71eb7b3b80924a5290 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 Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index fde5b98af6..be8b113b1a 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -260,17 +260,20 @@ rm -f .git/$m rm -f .git/logs/refs/heads/master test_expect_success \ "create $m (logged by touch)" \ - 'GIT_COMMITTER_DATE="2005-05-26 23:30" \ + 'test_config core.logAllRefUpdates false && + GIT_COMMITTER_DATE="2005-05-26 23:30" \ git update-ref --create-reflog HEAD '"$A"' -m "Initial Creation" && test '"$A"' = $(cat .git/'"$m"')' test_expect_success \ "update $m (logged by touch)" \ - 'GIT_COMMITTER_DATE="2005-05-26 23:31" \ + 'test_config core.logAllRefUpdates false && + GIT_COMMITTER_DATE="2005-05-26 23:31" \ git update-ref HEAD'" $B $A "'-m "Switch" && test '"$B"' = $(cat .git/'"$m"')' test_expect_success \ "set $m (logged by touch)" \ - 'GIT_COMMITTER_DATE="2005-05-26 23:41" \ + 'test_config core.logAllRefUpdates false && + GIT_COMMITTER_DATE="2005-05-26 23:41" \ git update-ref HEAD'" $A && test $A"' = $(cat .git/'"$m"')' @@ -311,24 +314,22 @@ test_expect_success \ "test_cmp expect .git/logs/$m" rm -rf .git/$m .git/logs expect -test_expect_success \ - 'enable core.logAllRefUpdates' \ - 'git config core.logAllRefUpdates true && - test true = $(git config --bool --get core.logAllRefUpdates)' - test_expect_success \ "create $m (logged by config)" \ - 'GIT_COMMITTER_DATE="2005-05-26 23:32" \ + 'test_config core.logAllRefUpdates true && + GIT_COMMITTER_DATE="2005-05-26 23:32" \ git update-ref HEAD'" $A "'-m "Initial Creation" && test '"$A"' = $(cat .git/'"$m"')' test_expect_success \ "update $m (logged by config)" \ - 'GIT_COMMITTER_DATE="2005-05-26 23:33" \ + 'test_config core.logAllRefUpdates true && + GIT_COMMITTER_DATE="2005-05-26 23:33" \ git update-ref HEAD'" $B $A "'-m "Switch" && test '"$B"' = $(cat .git/'"$m"')' test_expect_success \ "set $m (logged by config)" \ - 'GIT_COMMITTER_DATE="2005-05-26 23:43" \ + 'test_config core.logAllRefUpdates true && + GIT_COMMITTER_DATE="2005-05-26 23:43" \ git update-ref HEAD '"$A && test $A"' = $(cat .git/'"$m"')'