t7508: 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
22179b3078
commit
c63659dd96
@ -130,8 +130,7 @@ cat >expect <<\EOF
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'status (advice.statusHints false)' '
|
test_expect_success 'status (advice.statusHints false)' '
|
||||||
test_when_finished "git config --unset advice.statusHints" &&
|
test_config advice.statusHints false &&
|
||||||
git config advice.statusHints false &&
|
|
||||||
git status >output &&
|
git status >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
|
|
||||||
@ -331,8 +330,7 @@ test_expect_success 'status -uno' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'status (status.showUntrackedFiles no)' '
|
test_expect_success 'status (status.showUntrackedFiles no)' '
|
||||||
git config status.showuntrackedfiles no
|
test_config status.showuntrackedfiles no &&
|
||||||
test_when_finished "git config --unset status.showuntrackedfiles" &&
|
|
||||||
git status >output &&
|
git status >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
@ -347,12 +345,11 @@ cat >expect <<EOF
|
|||||||
#
|
#
|
||||||
# Untracked files not listed
|
# Untracked files not listed
|
||||||
EOF
|
EOF
|
||||||
git config advice.statusHints false
|
|
||||||
test_expect_success 'status -uno (advice.statusHints false)' '
|
test_expect_success 'status -uno (advice.statusHints false)' '
|
||||||
|
test_config advice.statusHints false &&
|
||||||
git status -uno >output &&
|
git status -uno >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
git config --unset advice.statusHints
|
|
||||||
|
|
||||||
cat >expect << EOF
|
cat >expect << EOF
|
||||||
M dir1/modified
|
M dir1/modified
|
||||||
@ -399,8 +396,7 @@ test_expect_success 'status -unormal' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'status (status.showUntrackedFiles normal)' '
|
test_expect_success 'status (status.showUntrackedFiles normal)' '
|
||||||
git config status.showuntrackedfiles normal
|
test_config status.showuntrackedfiles normal
|
||||||
test_when_finished "git config --unset status.showuntrackedfiles" &&
|
|
||||||
git status >output &&
|
git status >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
@ -458,8 +454,7 @@ test_expect_success 'status -uall' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'status (status.showUntrackedFiles all)' '
|
test_expect_success 'status (status.showUntrackedFiles all)' '
|
||||||
git config status.showuntrackedfiles all
|
test_config status.showuntrackedfiles all
|
||||||
test_when_finished "git config --unset status.showuntrackedfiles" &&
|
|
||||||
git status >output &&
|
git status >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
@ -484,10 +479,9 @@ test_expect_success 'status -s -uall' '
|
|||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
'
|
'
|
||||||
test_expect_success 'status -s (status.showUntrackedFiles all)' '
|
test_expect_success 'status -s (status.showUntrackedFiles all)' '
|
||||||
git config status.showuntrackedfiles all
|
test_config status.showuntrackedfiles all &&
|
||||||
git status -s >output &&
|
git status -s >output &&
|
||||||
rm -rf dir3 &&
|
rm -rf dir3 &&
|
||||||
git config --unset status.showuntrackedfiles &&
|
|
||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
@ -587,15 +581,13 @@ cat >expect <<\EOF
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'status with color.ui' '
|
test_expect_success 'status with color.ui' '
|
||||||
git config color.ui always &&
|
test_config color.ui always &&
|
||||||
test_when_finished "git config --unset color.ui" &&
|
|
||||||
git status | test_decode_color >output &&
|
git status | test_decode_color >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'status with color.status' '
|
test_expect_success 'status with color.status' '
|
||||||
git config color.status always &&
|
test_config color.status always &&
|
||||||
test_when_finished "git config --unset color.status" &&
|
|
||||||
git status | test_decode_color >output &&
|
git status | test_decode_color >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
@ -719,8 +711,7 @@ EOF
|
|||||||
|
|
||||||
test_expect_success 'status without relative paths' '
|
test_expect_success 'status without relative paths' '
|
||||||
|
|
||||||
git config status.relativePaths false &&
|
test_config status.relativePaths false &&
|
||||||
test_when_finished "git config --unset status.relativePaths" &&
|
|
||||||
(cd dir1 && git status) >output &&
|
(cd dir1 && git status) >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
|
|
||||||
@ -739,8 +730,7 @@ EOF
|
|||||||
|
|
||||||
test_expect_success 'status -s without relative paths' '
|
test_expect_success 'status -s without relative paths' '
|
||||||
|
|
||||||
git config status.relativePaths false &&
|
test_config status.relativePaths false &&
|
||||||
test_when_finished "git config --unset status.relativePaths" &&
|
|
||||||
(cd dir1 && git status -s) >output &&
|
(cd dir1 && git status -s) >output &&
|
||||||
test_cmp expect output
|
test_cmp expect output
|
||||||
|
|
||||||
@ -1037,15 +1027,14 @@ test_expect_success '--ignore-submodules=untracked suppresses submodules with un
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
|
test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
|
||||||
git config diff.ignoreSubmodules dirty &&
|
test_config diff.ignoreSubmodules dirty &&
|
||||||
git status >output &&
|
git status >output &&
|
||||||
test_i18ncmp expect output &&
|
test_i18ncmp expect output &&
|
||||||
git config --add -f .gitmodules submodule.subname.ignore untracked &&
|
git config --add -f .gitmodules submodule.subname.ignore untracked &&
|
||||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||||
git status >output &&
|
git status >output &&
|
||||||
test_i18ncmp expect output &&
|
test_i18ncmp expect output &&
|
||||||
git config -f .gitmodules --remove-section submodule.subname &&
|
git config -f .gitmodules --remove-section submodule.subname
|
||||||
git config --unset diff.ignoreSubmodules
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
|
test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
|
||||||
@ -1065,15 +1054,14 @@ test_expect_success '--ignore-submodules=dirty suppresses submodules with untrac
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
|
test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
|
||||||
git config diff.ignoreSubmodules dirty &&
|
test_config diff.ignoreSubmodules dirty &&
|
||||||
git status >output &&
|
git status >output &&
|
||||||
! test -s actual &&
|
! test -s actual &&
|
||||||
git config --add -f .gitmodules submodule.subname.ignore dirty &&
|
git config --add -f .gitmodules submodule.subname.ignore dirty &&
|
||||||
git config --add -f .gitmodules submodule.subname.path sm &&
|
git config --add -f .gitmodules submodule.subname.path sm &&
|
||||||
git status >output &&
|
git status >output &&
|
||||||
test_i18ncmp expect output &&
|
test_i18ncmp expect output &&
|
||||||
git config -f .gitmodules --remove-section submodule.subname &&
|
git config -f .gitmodules --remove-section submodule.subname
|
||||||
git config --unset diff.ignoreSubmodules
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
|
test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
|
||||||
@ -1290,15 +1278,13 @@ cat > expect << EOF
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success "status (core.commentchar with submodule summary)" '
|
test_expect_success "status (core.commentchar with submodule summary)" '
|
||||||
test_when_finished "git config --unset core.commentchar" &&
|
test_config core.commentchar ";" &&
|
||||||
git config core.commentchar ";" &&
|
|
||||||
git status >output &&
|
git status >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success "status (core.commentchar with two chars with submodule summary)" '
|
test_expect_success "status (core.commentchar with two chars with submodule summary)" '
|
||||||
test_when_finished "git config --unset core.commentchar" &&
|
test_config core.commentchar ";;" &&
|
||||||
git config core.commentchar ";;" &&
|
|
||||||
git status >output &&
|
git status >output &&
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
'
|
'
|
||||||
|
Loading…
Reference in New Issue
Block a user