Skip to content

Commit 3e5584c

Browse files
kyleamgitster
authored andcommitted
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 0bee591 (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 <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f950e89 commit 3e5584c

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

t/t1400-update-ref.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,20 @@ rm -f .git/$m
260260
rm -f .git/logs/refs/heads/master
261261
test_expect_success \
262262
"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" \
264265
git update-ref --create-reflog HEAD '"$A"' -m "Initial Creation" &&
265266
test '"$A"' = $(cat .git/'"$m"')'
266267
test_expect_success \
267268
"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" \
269271
git update-ref HEAD'" $B $A "'-m "Switch" &&
270272
test '"$B"' = $(cat .git/'"$m"')'
271273
test_expect_success \
272274
"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" \
274277
git update-ref HEAD'" $A &&
275278
test $A"' = $(cat .git/'"$m"')'
276279

@@ -311,24 +314,22 @@ test_expect_success \
311314
"test_cmp expect .git/logs/$m"
312315
rm -rf .git/$m .git/logs expect
313316

314-
test_expect_success \
315-
'enable core.logAllRefUpdates' \
316-
'git config core.logAllRefUpdates true &&
317-
test true = $(git config --bool --get core.logAllRefUpdates)'
318-
319317
test_expect_success \
320318
"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" \
322321
git update-ref HEAD'" $A "'-m "Initial Creation" &&
323322
test '"$A"' = $(cat .git/'"$m"')'
324323
test_expect_success \
325324
"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" \
327327
git update-ref HEAD'" $B $A "'-m "Switch" &&
328328
test '"$B"' = $(cat .git/'"$m"')'
329329
test_expect_success \
330330
"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" \
332333
git update-ref HEAD '"$A &&
333334
test $A"' = $(cat .git/'"$m"')'
334335

0 commit comments

Comments
 (0)