Skip to content

Commit 795290e

Browse files
j6tgitster
authored andcommitted
t1300: attempting to remove a non-existent .git/config is not an error
Since some tests before test number 79 ("quoting") are skipped, .git/config does not exist and 'rm .git/config' fails. Fix this particular case. While at it, move other instance of 'rm .git/config' that occur in this file inside the test function to document that the test cases want to protect themselves from remnants of earlier tests. Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 88d42af commit 795290e

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

t/t1300-repo-config.sh

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,6 @@ EOF
552552
test_expect_success "section was removed properly" \
553553
"test_cmp expect .git/config"
554554

555-
rm .git/config
556-
557555
cat > expect << EOF
558556
[gitcvs]
559557
enabled = true
@@ -564,6 +562,7 @@ EOF
564562

565563
test_expect_success 'section ending' '
566564
565+
rm -f .git/config &&
567566
git config gitcvs.enabled true &&
568567
git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
569568
git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
@@ -636,8 +635,6 @@ test_expect_success 'invalid bool (set)' '
636635
637636
test_must_fail git config --bool bool.nobool foobar'
638637

639-
rm .git/config
640-
641638
cat > expect <<\EOF
642639
[bool]
643640
true1 = true
@@ -652,6 +649,7 @@ EOF
652649

653650
test_expect_success 'set --bool' '
654651
652+
rm -f .git/config &&
655653
git config --bool bool.true1 01 &&
656654
git config --bool bool.true2 -1 &&
657655
git config --bool bool.true3 YeS &&
@@ -662,8 +660,6 @@ test_expect_success 'set --bool' '
662660
git config --bool bool.false4 FALSE &&
663661
cmp expect .git/config'
664662

665-
rm .git/config
666-
667663
cat > expect <<\EOF
668664
[int]
669665
val1 = 1
@@ -673,13 +669,12 @@ EOF
673669

674670
test_expect_success 'set --int' '
675671
672+
rm -f .git/config &&
676673
git config --int int.val1 01 &&
677674
git config --int int.val2 -1 &&
678675
git config --int int.val3 5m &&
679676
cmp expect .git/config'
680677

681-
rm .git/config
682-
683678
cat >expect <<\EOF
684679
[bool]
685680
true1 = true
@@ -693,6 +688,7 @@ cat >expect <<\EOF
693688
EOF
694689

695690
test_expect_success 'get --bool-or-int' '
691+
rm -f .git/config &&
696692
(
697693
echo "[bool]"
698694
echo true1
@@ -712,7 +708,6 @@ test_expect_success 'get --bool-or-int' '
712708
713709
'
714710

715-
rm .git/config
716711
cat >expect <<\EOF
717712
[bool]
718713
true1 = true
@@ -726,6 +721,7 @@ cat >expect <<\EOF
726721
EOF
727722

728723
test_expect_success 'set --bool-or-int' '
724+
rm -f .git/config &&
729725
git config --bool-or-int bool.true1 true &&
730726
git config --bool-or-int bool.false1 false &&
731727
git config --bool-or-int bool.true2 yes &&
@@ -736,8 +732,6 @@ test_expect_success 'set --bool-or-int' '
736732
test_cmp expect .git/config
737733
'
738734

739-
rm .git/config
740-
741735
cat >expect <<\EOF
742736
[path]
743737
home = ~/
@@ -746,6 +740,7 @@ cat >expect <<\EOF
746740
EOF
747741

748742
test_expect_success NOT_MINGW 'set --path' '
743+
rm -f .git/config &&
749744
git config --path path.home "~/" &&
750745
git config --path path.normal "/dev/null" &&
751746
git config --path path.trailingtilde "foo~" &&
@@ -794,7 +789,7 @@ cat > expect << EOF
794789
hash = "test#test"
795790
EOF
796791
test_expect_success 'quoting' '
797-
rm .git/config &&
792+
rm -f .git/config &&
798793
git config quote.leading " test" &&
799794
git config quote.ending "test " &&
800795
git config quote.semicolon "test;test" &&

0 commit comments

Comments
 (0)