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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jun 22, 2018 at 05:23 UTC 7687f19e939dd8c9a2a67ede31b019092f0a1ccf
2 files changed +19 -19
t/t1410-reflog.sh
+2 -2
@@ -339,8 +339,8 @@ test_expect_failure 'reflog with non-commit entries displays all entries' '
339 '
340
341 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 &&
344 git update-ref referrent HEAD &&
345 git symbolic-ref refs/heads/the_symref refs/heads/referrent &&
346 test_when_finished "rm -f .git/refs/heads/referrent.lock" &&
t/t3200-branch.sh
+17 -17
@@ -49,9 +49,9 @@ test_expect_success 'git branch HEAD should fail' '
49 cat >expect <<EOF
50 $ZERO_OID $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
51 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' '
53 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 &&
55 test_path_is_file .git/refs/heads/d/e/f &&
56 test_path_is_file .git/logs/refs/heads/d/e/f &&
57 test_cmp expect .git/logs/refs/heads/d/e/f
@@ -82,7 +82,7 @@ test_expect_success 'git branch -m dumps usage' '
82
83 test_expect_success 'git branch -m m broken_symref should work' '
84 test_when_finished "git branch -D broken_symref" &&
85 - git branch -l m &&
85 + git branch --create-reflog m &&
86 git symbolic-ref refs/heads/broken_symref refs/heads/i_am_broken &&
87 git branch -m m broken_symref &&
88 git reflog exists refs/heads/broken_symref &&
@@ -90,13 +90,13 @@ test_expect_success 'git branch -m m broken_symref should work' '
90 '
91
92 test_expect_success 'git branch -m m m/m should work' '
93 - git branch -l m &&
93 + git branch --create-reflog m &&
94 git branch -m m m/m &&
95 git reflog exists refs/heads/m/m
96 '
97
98 test_expect_success 'git branch -m n/n n should work' '
99 - git branch -l n/n &&
99 + git branch --create-reflog n/n &&
100 git branch -m n/n n &&
101 git reflog exists refs/heads/n
102 '
@@ -378,9 +378,9 @@ mv .git/config-saved .git/config
378 git config branch.s/s.dummy Hello
379
380 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 &&
382 git reflog exists refs/heads/s/s &&
383 - git branch -l s/t &&
383 + git branch --create-reflog s/t &&
384 git reflog exists refs/heads/s/t &&
385 git branch -d s/t &&
386 git branch -m s/s s &&
@@ -444,7 +444,7 @@ test_expect_success 'git branch --copy dumps usage' '
444 '
445
446 test_expect_success 'git branch -c d e should work' '
447 - git branch -l d &&
447 + git branch --create-reflog d &&
448 git reflog exists refs/heads/d &&
449 git config branch.d.dummy Hello &&
450 git branch -c d e &&
@@ -459,7 +459,7 @@ test_expect_success 'git branch -c d e should work' '
459 '
460
461 test_expect_success 'git branch --copy is a synonym for -c' '
462 - git branch -l copy &&
462 + git branch --create-reflog copy &&
463 git reflog exists refs/heads/copy &&
464 git config branch.copy.dummy Hello &&
465 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' '
486 '
487
488 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 &&
490 git reflog exists refs/heads/f/f &&
491 git config branch.f/f.dummy Hello &&
492 git branch -c f/f g/g &&
@@ -497,7 +497,7 @@ test_expect_success 'git branch -c f/f g/g should work' '
497 '
498
499 test_expect_success 'git branch -c m2 m2 should work' '
500 - git branch -l m2 &&
500 + git branch --create-reflog m2 &&
501 git reflog exists refs/heads/m2 &&
502 git config branch.m2.dummy Hello &&
503 git branch -c m2 m2 &&
@@ -506,18 +506,18 @@ test_expect_success 'git branch -c m2 m2 should work' '
506 '
507
508 test_expect_success 'git branch -c zz zz/zz should fail' '
509 - git branch -l zz &&
509 + git branch --create-reflog zz &&
510 git reflog exists refs/heads/zz &&
511 test_must_fail git branch -c zz zz/zz
512 '
513
514 test_expect_success 'git branch -c b/b b should fail' '
515 - git branch -l b/b &&
515 + git branch --create-reflog b/b &&
516 test_must_fail git branch -c b/b b
517 '
518
519 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 &&
521 git reflog exists refs/heads/o/q &&
522 git reflog exists refs/heads/o/p &&
523 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
570 '
571
572 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 &&
574 git reflog exists refs/heads/cd &&
575 git config branch.cd.dummy CD &&
576 - git branch -l ab &&
576 + git branch --create-reflog ab &&
577 git reflog exists refs/heads/ab &&
578 git config branch.ab.dummy AB &&
579 git branch -C ab cd &&
@@ -685,7 +685,7 @@ test_expect_success 'renaming a symref is not allowed' '
685 '
686
687 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 &&
689 mv .git/logs/refs/heads/u real-u &&
690 ln -s real-u .git/logs/refs/heads/u &&
691 test_must_fail git branch -m u v