Skip to content

Commit 7687f19

Browse files
peffgitster
authored andcommitted
t: switch "branch -l" to "branch --create-reflog"
In preparation for deprecating "-l", let's make sure we're using the recommended option ourselves. This patch just mechanically converts "branch -l" to "branch --create-reflog". Note that with the exception of the actual "--create-reflog" test, we could actually remove "-l" entirely from most of these callers. That's because these days core.logallrefupdates defaults to true in a non-bare repository. I've left them in place, though, since they serve to document the expectation of the test, even if they are technically noops. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6b15595 commit 7687f19

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

t/t1410-reflog.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ test_expect_failure 'reflog with non-commit entries displays all entries' '
339339
'
340340

341341
test_expect_success 'reflog expire operates on symref not referrent' '
342-
git branch -l the_symref &&
343-
git branch -l referrent &&
342+
git branch --create-reflog the_symref &&
343+
git branch --create-reflog referrent &&
344344
git update-ref referrent HEAD &&
345345
git symbolic-ref refs/heads/the_symref refs/heads/referrent &&
346346
test_when_finished "rm -f .git/refs/heads/referrent.lock" &&

t/t3200-branch.sh

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ test_expect_success 'git branch HEAD should fail' '
4949
cat >expect <<EOF
5050
$ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
5151
EOF
52-
test_expect_success 'git branch -l d/e/f should create a branch and a log' '
52+
test_expect_success 'git branch --create-reflog d/e/f should create a branch and a log' '
5353
GIT_COMMITTER_DATE="2005-05-26 23:30" \
54-
git -c core.logallrefupdates=false branch -l d/e/f &&
54+
git -c core.logallrefupdates=false branch --create-reflog d/e/f &&
5555
test_path_is_file .git/refs/heads/d/e/f &&
5656
test_path_is_file .git/logs/refs/heads/d/e/f &&
5757
test_cmp expect .git/logs/refs/heads/d/e/f
@@ -82,21 +82,21 @@ test_expect_success 'git branch -m dumps usage' '
8282

8383
test_expect_success 'git branch -m m broken_symref should work' '
8484
test_when_finished "git branch -D broken_symref" &&
85-
git branch -l m &&
85+
git branch --create-reflog m &&
8686
git symbolic-ref refs/heads/broken_symref refs/heads/i_am_broken &&
8787
git branch -m m broken_symref &&
8888
git reflog exists refs/heads/broken_symref &&
8989
test_must_fail git reflog exists refs/heads/i_am_broken
9090
'
9191

9292
test_expect_success 'git branch -m m m/m should work' '
93-
git branch -l m &&
93+
git branch --create-reflog m &&
9494
git branch -m m m/m &&
9595
git reflog exists refs/heads/m/m
9696
'
9797

9898
test_expect_success 'git branch -m n/n n should work' '
99-
git branch -l n/n &&
99+
git branch --create-reflog n/n &&
100100
git branch -m n/n n &&
101101
git reflog exists refs/heads/n
102102
'
@@ -378,9 +378,9 @@ mv .git/config-saved .git/config
378378
git config branch.s/s.dummy Hello
379379

380380
test_expect_success 'git branch -m s/s s should work when s/t is deleted' '
381-
git branch -l s/s &&
381+
git branch --create-reflog s/s &&
382382
git reflog exists refs/heads/s/s &&
383-
git branch -l s/t &&
383+
git branch --create-reflog s/t &&
384384
git reflog exists refs/heads/s/t &&
385385
git branch -d s/t &&
386386
git branch -m s/s s &&
@@ -444,7 +444,7 @@ test_expect_success 'git branch --copy dumps usage' '
444444
'
445445

446446
test_expect_success 'git branch -c d e should work' '
447-
git branch -l d &&
447+
git branch --create-reflog d &&
448448
git reflog exists refs/heads/d &&
449449
git config branch.d.dummy Hello &&
450450
git branch -c d e &&
@@ -459,7 +459,7 @@ test_expect_success 'git branch -c d e should work' '
459459
'
460460

461461
test_expect_success 'git branch --copy is a synonym for -c' '
462-
git branch -l copy &&
462+
git branch --create-reflog copy &&
463463
git reflog exists refs/heads/copy &&
464464
git config branch.copy.dummy Hello &&
465465
git branch --copy copy copy-to &&
@@ -486,7 +486,7 @@ test_expect_success 'git branch -c ee ef should copy ee to create branch ef' '
486486
'
487487

488488
test_expect_success 'git branch -c f/f g/g should work' '
489-
git branch -l f/f &&
489+
git branch --create-reflog f/f &&
490490
git reflog exists refs/heads/f/f &&
491491
git config branch.f/f.dummy Hello &&
492492
git branch -c f/f g/g &&
@@ -497,7 +497,7 @@ test_expect_success 'git branch -c f/f g/g should work' '
497497
'
498498

499499
test_expect_success 'git branch -c m2 m2 should work' '
500-
git branch -l m2 &&
500+
git branch --create-reflog m2 &&
501501
git reflog exists refs/heads/m2 &&
502502
git config branch.m2.dummy Hello &&
503503
git branch -c m2 m2 &&
@@ -506,18 +506,18 @@ test_expect_success 'git branch -c m2 m2 should work' '
506506
'
507507

508508
test_expect_success 'git branch -c zz zz/zz should fail' '
509-
git branch -l zz &&
509+
git branch --create-reflog zz &&
510510
git reflog exists refs/heads/zz &&
511511
test_must_fail git branch -c zz zz/zz
512512
'
513513

514514
test_expect_success 'git branch -c b/b b should fail' '
515-
git branch -l b/b &&
515+
git branch --create-reflog b/b &&
516516
test_must_fail git branch -c b/b b
517517
'
518518

519519
test_expect_success 'git branch -C o/q o/p should work when o/p exists' '
520-
git branch -l o/q &&
520+
git branch --create-reflog o/q &&
521521
git reflog exists refs/heads/o/q &&
522522
git reflog exists refs/heads/o/p &&
523523
git branch -C o/q o/p
@@ -570,10 +570,10 @@ test_expect_success 'git branch -C master5 master5 should work when master is ch
570570
'
571571

572572
test_expect_success 'git branch -C ab cd should overwrite existing config for cd' '
573-
git branch -l cd &&
573+
git branch --create-reflog cd &&
574574
git reflog exists refs/heads/cd &&
575575
git config branch.cd.dummy CD &&
576-
git branch -l ab &&
576+
git branch --create-reflog ab &&
577577
git reflog exists refs/heads/ab &&
578578
git config branch.ab.dummy AB &&
579579
git branch -C ab cd &&
@@ -685,7 +685,7 @@ test_expect_success 'renaming a symref is not allowed' '
685685
'
686686

687687
test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for u is a symlink' '
688-
git branch -l u &&
688+
git branch --create-reflog u &&
689689
mv .git/logs/refs/heads/u real-u &&
690690
ln -s real-u .git/logs/refs/heads/u &&
691691
test_must_fail git branch -m u v

0 commit comments

Comments
 (0)