mirror of
https://github.com/git/git
synced 2024-09-12 21:04:12 +00:00
t7500: use test_config to set/unset git config variables
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>
This commit is contained in:
parent
8677b777a5
commit
22179b3078
|
@ -36,8 +36,7 @@ test_expect_success 'nonexistent template file should return error' '
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'nonexistent template file in config should return error' '
|
test_expect_success 'nonexistent template file in config should return error' '
|
||||||
git config commit.template "$PWD"/notexist &&
|
test_config commit.template "$PWD"/notexist &&
|
||||||
test_when_finished "git config --unset commit.template" &&
|
|
||||||
(
|
(
|
||||||
GIT_EDITOR="echo hello >\"\$1\"" &&
|
GIT_EDITOR="echo hello >\"\$1\"" &&
|
||||||
export GIT_EDITOR &&
|
export GIT_EDITOR &&
|
||||||
|
@ -93,14 +92,13 @@ test_expect_success '-t option should be short for --template' '
|
||||||
|
|
||||||
test_expect_success 'config-specified template should commit' '
|
test_expect_success 'config-specified template should commit' '
|
||||||
echo "new template" > "$TEMPLATE" &&
|
echo "new template" > "$TEMPLATE" &&
|
||||||
git config commit.template "$TEMPLATE" &&
|
test_config commit.template "$TEMPLATE" &&
|
||||||
echo "more content" >> foo &&
|
echo "more content" >> foo &&
|
||||||
git add foo &&
|
git add foo &&
|
||||||
(
|
(
|
||||||
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
|
test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
|
||||||
git commit
|
git commit
|
||||||
) &&
|
) &&
|
||||||
git config --unset commit.template &&
|
|
||||||
commit_msg_is "new templatecommit message"
|
commit_msg_is "new templatecommit message"
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue