t4304: use test_config to set/unset git config variables
authorYann Droneaud <ydroneaud@opteya.com>
Sun, 24 Mar 2013 21:06:04 +0000 (22:06 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Mar 2013 15:50:53 +0000 (08:50 -0700)
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.

Tests are modified to assume correct (default) configuration at entry,
and to reset the modified configuration variables at the end.

Signed-off-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3404-rebase-interactive.sh
index 15dcbd42d367c3ef6b487e0f235ad201b6cf8413..a58406d12fc8dabf8f2e73e721d2f622a781cc9a 100755 (executable)
@@ -937,8 +937,7 @@ test_expect_success 'rebase --edit-todo can be used to modify todo' '
 test_expect_success 'rebase -i respects core.commentchar' '
        git reset --hard &&
        git checkout E^0 &&
-       git config core.commentchar "\\" &&
-       test_when_finished "git config --unset core.commentchar" &&
+       test_config core.commentchar "\\" &&
        write_script remove-all-but-first.sh <<-\EOF &&
        sed -e "2,\$s/^/\\\\/" "$1" >"$1.tmp" &&
        mv "$1.tmp" "$1"