Skip to content

Commit

Permalink
t4034: use test_config/test_unconfig to set/unset git config variables
Browse files Browse the repository at this point in the history
Instead of using construct such as:
    test_when_finished "git config --unset <key>"
    git config <key> <value>
uses
    test_config <key> <value>
The latter takes care of removing <key> at the end of the test.

Additionally, instead of
     git config <key> ""
or
     git config --unset <key>
uses
     test_unconfig <key>
The latter doesn't failed if <key> is not defined.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Yann Droneaud authored and Junio C Hamano committed Mar 25, 2013
1 parent aac6c2f commit ff73aa4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions t/t4034-diff-words.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ test_expect_success '.gitattributes override config' '
'
test_expect_success 'setup: remove diff driver regex' '
test_might_fail git config --unset diff.testdriver.wordRegex
test_unconfig diff.testdriver.wordRegex
'
test_expect_success 'use configured regex' '
Expand Down Expand Up @@ -335,8 +335,7 @@ test_expect_success 'word-diff with diff.sbe' '
c
EOF
test_when_finished "git config --unset diff.suppress-blank-empty" &&
git config diff.suppress-blank-empty true &&
test_config diff.suppress-blank-empty true &&
word_diff --word-diff=plain
'
Expand Down Expand Up @@ -368,7 +367,7 @@ test_expect_success 'setup history with two files' '
test_expect_success 'wordRegex for the first file does not apply to the second' '
echo "*.tex diff=tex" >.gitattributes &&
git config diff.tex.wordRegex "[a-z]+|." &&
test_config diff.tex.wordRegex "[a-z]+|." &&
cat >expect <<-\EOF &&
diff --git a/a.tex b/a.tex
--- a/a.tex
Expand Down

0 comments on commit ff73aa4

Please sign in to comment.