Skip to content

Commit

Permalink
t7500: use test_config 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.

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 8677b77 commit 22179b3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions t/t7500-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ test_expect_success 'nonexistent template file should return error' '
'

test_expect_success 'nonexistent template file in config should return error' '
git config commit.template "$PWD"/notexist &&
test_when_finished "git config --unset commit.template" &&
test_config commit.template "$PWD"/notexist &&
(
GIT_EDITOR="echo hello >\"\$1\"" &&
export GIT_EDITOR &&
Expand Down Expand Up @@ -93,14 +92,13 @@ test_expect_success '-t option should be short for --template' '

test_expect_success 'config-specified template should commit' '
echo "new template" > "$TEMPLATE" &&
git config commit.template "$TEMPLATE" &&
test_config commit.template "$TEMPLATE" &&
echo "more content" >> foo &&
git add foo &&
(
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
git commit
) &&
git config --unset commit.template &&
commit_msg_is "new templatecommit message"
'

Expand Down

0 comments on commit 22179b3

Please sign in to comment.