Skip to content

Commit b209995

Browse files
erickmattosgitster
authored andcommitted
t3200: test -l with core.logAllRefUpdates options
By default reflogs are always created for new local branches by "checkout -b". But by setting core.logAllRefUpdates to false this will not be true anymore. In that case you only create the reflogs when you use -l switch with "checkout -b". Added missing tests to check expected behaviors. Signed-off-by: Erick Mattos <erick.mattos@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3631bf7 commit b209995

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

t/t3200-branch.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,30 @@ test_expect_success \
224224
test -f .git/logs/refs/heads/g/h/i &&
225225
diff expect .git/logs/refs/heads/g/h/i'
226226

227+
test_expect_success 'checkout -b makes reflog by default' '
228+
git checkout master &&
229+
git config --unset core.logAllRefUpdates &&
230+
git checkout -b alpha &&
231+
test -f .git/logs/refs/heads/alpha &&
232+
PAGER= git reflog show alpha
233+
'
234+
235+
test_expect_success 'checkout -b does not make reflog when core.logAllRefUpdates = false' '
236+
git checkout master &&
237+
git config core.logAllRefUpdates false &&
238+
git checkout -b beta &&
239+
! test -f .git/logs/refs/heads/beta &&
240+
test_must_fail PAGER= git reflog show beta
241+
'
242+
243+
test_expect_success 'checkout -b with -l makes reflog when core.logAllRefUpdates = false' '
244+
git checkout master &&
245+
git checkout -lb gamma &&
246+
git config --unset core.logAllRefUpdates &&
247+
test -f .git/logs/refs/heads/gamma &&
248+
PAGER= git reflog show gamma
249+
'
250+
227251
test_expect_success 'avoid ambiguous track' '
228252
git config branch.autosetupmerge true &&
229253
git config remote.ambi1.url lalala &&

0 commit comments

Comments
 (0)