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

Johannes Sixt committed Oct 19, 2011 at 09:37 UTC 795290e528deeb4b0578b366af6b4c0c6773e2c9
1 file changed +7 -12
t/t1300-repo-config.sh
+7 -12
@@ -552,8 +552,6 @@ EOF
552 test_expect_success "section was removed properly" \
553 "test_cmp expect .git/config"
554
555 -rm .git/config
556 -
555 cat > expect << EOF
556 [gitcvs]
557 enabled = true
@@ -564,6 +562,7 @@ EOF
562
563 test_expect_success 'section ending' '
564
565 + rm -f .git/config &&
566 git config gitcvs.enabled true &&
567 git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
568 git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
@@ -636,8 +635,6 @@ test_expect_success 'invalid bool (set)' '
635
636 test_must_fail git config --bool bool.nobool foobar'
637
639 -rm .git/config
640 -
638 cat > expect <<\EOF
639 [bool]
640 true1 = true
@@ -652,6 +649,7 @@ EOF
649
650 test_expect_success 'set --bool' '
651
652 + rm -f .git/config &&
653 git config --bool bool.true1 01 &&
654 git config --bool bool.true2 -1 &&
655 git config --bool bool.true3 YeS &&
@@ -662,8 +660,6 @@ test_expect_success 'set --bool' '
660 git config --bool bool.false4 FALSE &&
661 cmp expect .git/config'
662
665 -rm .git/config
666 -
663 cat > expect <<\EOF
664 [int]
665 val1 = 1
@@ -673,13 +669,12 @@ EOF
669
670 test_expect_success 'set --int' '
671
672 + rm -f .git/config &&
673 git config --int int.val1 01 &&
674 git config --int int.val2 -1 &&
675 git config --int int.val3 5m &&
676 cmp expect .git/config'
677
681 -rm .git/config
682 -
678 cat >expect <<\EOF
679 [bool]
680 true1 = true
@@ -693,6 +688,7 @@ cat >expect <<\EOF
688 EOF
689
690 test_expect_success 'get --bool-or-int' '
691 + rm -f .git/config &&
692 (
693 echo "[bool]"
694 echo true1
@@ -712,7 +708,6 @@ test_expect_success 'get --bool-or-int' '
708
709 '
710
715 -rm .git/config
711 cat >expect <<\EOF
712 [bool]
713 true1 = true
@@ -726,6 +721,7 @@ cat >expect <<\EOF
721 EOF
722
723 test_expect_success 'set --bool-or-int' '
724 + rm -f .git/config &&
725 git config --bool-or-int bool.true1 true &&
726 git config --bool-or-int bool.false1 false &&
727 git config --bool-or-int bool.true2 yes &&
@@ -736,8 +732,6 @@ test_expect_success 'set --bool-or-int' '
732 test_cmp expect .git/config
733 '
734
739 -rm .git/config
740 -
735 cat >expect <<\EOF
736 [path]
737 home = ~/
@@ -746,6 +740,7 @@ cat >expect <<\EOF
740 EOF
741
742 test_expect_success NOT_MINGW 'set --path' '
743 + rm -f .git/config &&
744 git config --path path.home "~/" &&
745 git config --path path.normal "/dev/null" &&
746 git config --path path.trailingtilde "foo~" &&
@@ -794,7 +789,7 @@ cat > expect << EOF
789 hash = "test#test"
790 EOF
791 test_expect_success 'quoting' '
797 - rm .git/config &&
792 + rm -f .git/config &&
793 git config quote.leading " test" &&
794 git config quote.ending "test " &&
795 git config quote.semicolon "test;test" &&