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>
This commit is contained in:
Johannes Sixt
2011-10-19 09:37:06 +02:00
committed by Junio C Hamano
parent 88d42af893
commit 795290e528

View File

@ -552,8 +552,6 @@ EOF
test_expect_success "section was removed properly" \ test_expect_success "section was removed properly" \
"test_cmp expect .git/config" "test_cmp expect .git/config"
rm .git/config
cat > expect << EOF cat > expect << EOF
[gitcvs] [gitcvs]
enabled = true enabled = true
@ -564,6 +562,7 @@ EOF
test_expect_success 'section ending' ' test_expect_success 'section ending' '
rm -f .git/config &&
git config gitcvs.enabled true && git config gitcvs.enabled true &&
git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite && git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite && git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
@ -636,8 +635,6 @@ test_expect_success 'invalid bool (set)' '
test_must_fail git config --bool bool.nobool foobar' test_must_fail git config --bool bool.nobool foobar'
rm .git/config
cat > expect <<\EOF cat > expect <<\EOF
[bool] [bool]
true1 = true true1 = true
@ -652,6 +649,7 @@ EOF
test_expect_success 'set --bool' ' test_expect_success 'set --bool' '
rm -f .git/config &&
git config --bool bool.true1 01 && git config --bool bool.true1 01 &&
git config --bool bool.true2 -1 && git config --bool bool.true2 -1 &&
git config --bool bool.true3 YeS && git config --bool bool.true3 YeS &&
@ -662,8 +660,6 @@ test_expect_success 'set --bool' '
git config --bool bool.false4 FALSE && git config --bool bool.false4 FALSE &&
cmp expect .git/config' cmp expect .git/config'
rm .git/config
cat > expect <<\EOF cat > expect <<\EOF
[int] [int]
val1 = 1 val1 = 1
@ -673,13 +669,12 @@ EOF
test_expect_success 'set --int' ' test_expect_success 'set --int' '
rm -f .git/config &&
git config --int int.val1 01 && git config --int int.val1 01 &&
git config --int int.val2 -1 && git config --int int.val2 -1 &&
git config --int int.val3 5m && git config --int int.val3 5m &&
cmp expect .git/config' cmp expect .git/config'
rm .git/config
cat >expect <<\EOF cat >expect <<\EOF
[bool] [bool]
true1 = true true1 = true
@ -693,6 +688,7 @@ cat >expect <<\EOF
EOF EOF
test_expect_success 'get --bool-or-int' ' test_expect_success 'get --bool-or-int' '
rm -f .git/config &&
( (
echo "[bool]" echo "[bool]"
echo true1 echo true1
@ -712,7 +708,6 @@ test_expect_success 'get --bool-or-int' '
' '
rm .git/config
cat >expect <<\EOF cat >expect <<\EOF
[bool] [bool]
true1 = true true1 = true
@ -726,6 +721,7 @@ cat >expect <<\EOF
EOF EOF
test_expect_success 'set --bool-or-int' ' test_expect_success 'set --bool-or-int' '
rm -f .git/config &&
git config --bool-or-int bool.true1 true && git config --bool-or-int bool.true1 true &&
git config --bool-or-int bool.false1 false && git config --bool-or-int bool.false1 false &&
git config --bool-or-int bool.true2 yes && git config --bool-or-int bool.true2 yes &&
@ -736,8 +732,6 @@ test_expect_success 'set --bool-or-int' '
test_cmp expect .git/config test_cmp expect .git/config
' '
rm .git/config
cat >expect <<\EOF cat >expect <<\EOF
[path] [path]
home = ~/ home = ~/
@ -746,6 +740,7 @@ cat >expect <<\EOF
EOF EOF
test_expect_success NOT_MINGW 'set --path' ' test_expect_success NOT_MINGW 'set --path' '
rm -f .git/config &&
git config --path path.home "~/" && git config --path path.home "~/" &&
git config --path path.normal "/dev/null" && git config --path path.normal "/dev/null" &&
git config --path path.trailingtilde "foo~" && git config --path path.trailingtilde "foo~" &&
@ -794,7 +789,7 @@ cat > expect << EOF
hash = "test#test" hash = "test#test"
EOF EOF
test_expect_success 'quoting' ' test_expect_success 'quoting' '
rm .git/config && rm -f .git/config &&
git config quote.leading " test" && git config quote.leading " test" &&
git config quote.ending "test " && git config quote.ending "test " &&
git config quote.semicolon "test;test" && git config quote.semicolon "test;test" &&