From: Yann Droneaud <ydroneaud@opteya.com>
To: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Cc: Yann Droneaud <ydroneaud@opteya.com>
Subject: [PATCH 12/15] t7508: use test_config to set/unset git config variables
Date: Sun, 24 Mar 2013 22:06:11 +0100 [thread overview]
Message-ID: <b067bae5607f94705b4e12a1911bebc48ebb96f3.1364158574.git.ydroneaud@opteya.com> (raw)
In-Reply-To: <cover.1364158574.git.ydroneaud@opteya.com>
In-Reply-To: <cover.1364158574.git.ydroneaud@opteya.com>
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>
---
t/t7508-status.sh | 46 ++++++++++++++++------------------------------
1 file changed, 16 insertions(+), 30 deletions(-)
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index aecb4d1..e2ffdac 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -131,8 +131,7 @@ cat >expect <<\EOF
EOF
test_expect_success 'status (advice.statusHints false)' '
- test_when_finished "git config --unset advice.statusHints" &&
- git config advice.statusHints false &&
+ test_config advice.statusHints false &&
git status >output &&
test_i18ncmp expect output
@@ -332,8 +331,7 @@ test_expect_success 'status -uno' '
'
test_expect_success 'status (status.showUntrackedFiles no)' '
- git config status.showuntrackedfiles no
- test_when_finished "git config --unset status.showuntrackedfiles" &&
+ test_config status.showuntrackedfiles no &&
git status >output &&
test_i18ncmp expect output
'
@@ -348,12 +346,11 @@ cat >expect <<EOF
#
# Untracked files not listed
EOF
-git config advice.statusHints false
test_expect_success 'status -uno (advice.statusHints false)' '
+ test_config advice.statusHints false &&
git status -uno >output &&
test_i18ncmp expect output
'
-git config --unset advice.statusHints
cat >expect << EOF
M dir1/modified
@@ -400,8 +397,7 @@ test_expect_success 'status -unormal' '
'
test_expect_success 'status (status.showUntrackedFiles normal)' '
- git config status.showuntrackedfiles normal
- test_when_finished "git config --unset status.showuntrackedfiles" &&
+ test_config status.showuntrackedfiles normal
git status >output &&
test_i18ncmp expect output
'
@@ -459,8 +455,7 @@ test_expect_success 'status -uall' '
'
test_expect_success 'status (status.showUntrackedFiles all)' '
- git config status.showuntrackedfiles all
- test_when_finished "git config --unset status.showuntrackedfiles" &&
+ test_config status.showuntrackedfiles all
git status >output &&
test_i18ncmp expect output
'
@@ -485,10 +480,9 @@ test_expect_success 'status -s -uall' '
test_cmp expect output
'
test_expect_success 'status -s (status.showUntrackedFiles all)' '
- git config status.showuntrackedfiles all
+ test_config status.showuntrackedfiles all &&
git status -s >output &&
rm -rf dir3 &&
- git config --unset status.showuntrackedfiles &&
test_cmp expect output
'
@@ -588,15 +582,13 @@ cat >expect <<\EOF
EOF
test_expect_success 'status with color.ui' '
- git config color.ui always &&
- test_when_finished "git config --unset color.ui" &&
+ test_config color.ui always &&
git status | test_decode_color >output &&
test_i18ncmp expect output
'
test_expect_success 'status with color.status' '
- git config color.status always &&
- test_when_finished "git config --unset color.status" &&
+ test_config color.status always &&
git status | test_decode_color >output &&
test_i18ncmp expect output
'
@@ -720,8 +712,7 @@ EOF
test_expect_success 'status without relative paths' '
- git config status.relativePaths false &&
- test_when_finished "git config --unset status.relativePaths" &&
+ test_config status.relativePaths false &&
(cd dir1 && git status) >output &&
test_i18ncmp expect output
@@ -740,8 +731,7 @@ EOF
test_expect_success 'status -s without relative paths' '
- git config status.relativePaths false &&
- test_when_finished "git config --unset status.relativePaths" &&
+ test_config status.relativePaths false &&
(cd dir1 && git status -s) >output &&
test_cmp expect output
@@ -1038,15 +1028,14 @@ test_expect_success '--ignore-submodules=untracked suppresses submodules with un
'
test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
- git config diff.ignoreSubmodules dirty &&
+ test_config diff.ignoreSubmodules dirty &&
git status >output &&
test_i18ncmp expect output &&
git config --add -f .gitmodules submodule.subname.ignore untracked &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status >output &&
test_i18ncmp expect output &&
- git config -f .gitmodules --remove-section submodule.subname &&
- git config --unset diff.ignoreSubmodules
+ git config -f .gitmodules --remove-section submodule.subname
'
test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
@@ -1066,15 +1055,14 @@ test_expect_success '--ignore-submodules=dirty suppresses submodules with untrac
'
test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
- git config diff.ignoreSubmodules dirty &&
+ test_config diff.ignoreSubmodules dirty &&
git status >output &&
! test -s actual &&
git config --add -f .gitmodules submodule.subname.ignore dirty &&
git config --add -f .gitmodules submodule.subname.path sm &&
git status >output &&
test_i18ncmp expect output &&
- git config -f .gitmodules --remove-section submodule.subname &&
- git config --unset diff.ignoreSubmodules
+ git config -f .gitmodules --remove-section submodule.subname
'
test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
@@ -1291,15 +1279,13 @@ cat > expect << EOF
EOF
test_expect_success "status (core.commentchar with submodule summary)" '
- test_when_finished "git config --unset core.commentchar" &&
- git config core.commentchar ";" &&
+ test_config core.commentchar ";" &&
git status >output &&
test_i18ncmp expect output
'
test_expect_success "status (core.commentchar with two chars with submodule summary)" '
- test_when_finished "git config --unset core.commentchar" &&
- git config core.commentchar ";;" &&
+ test_config core.commentchar ";;" &&
git status >output &&
test_i18ncmp expect output
'
--
1.7.11.7
next prev parent reply other threads:[~2013-03-24 21:07 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 14:55 git merge <tag> behavior Yann Droneaud
2013-03-19 16:19 ` Junio C Hamano
2013-03-19 17:54 ` Re* " Junio C Hamano
2013-04-01 19:57 ` [PATCH 0/3] Merging an annotated tag object Junio C Hamano
2013-04-01 19:57 ` [PATCH 1/3] merge: a random object may not necssarily be a commit Junio C Hamano
2013-04-01 22:51 ` Yann Droneaud
2013-04-02 5:30 ` Jeff King
2013-04-02 15:02 ` Junio C Hamano
2013-04-02 15:03 ` Jeff King
2013-04-01 19:57 ` [PATCH 2/3] t6200: use test_config/test_unconfig Junio C Hamano
2013-04-01 19:57 ` [PATCH 3/3] t6200: test message for merging of an annotated tag Junio C Hamano
2013-03-20 17:53 ` [PATCH] Documentation: merging a tag is a special case Yann Droneaud
2013-03-20 18:54 ` Jonathan Nieder
2013-03-20 19:07 ` Junio C Hamano
2013-03-21 19:50 ` Junio C Hamano
2013-03-21 19:56 ` Jonathan Nieder
2013-03-21 20:10 ` Junio C Hamano
2013-03-21 20:39 ` Jonathan Nieder
2013-03-21 21:47 ` Yann Droneaud
2013-03-21 21:57 ` [PATCH v2] " Yann Droneaud
2013-03-21 22:41 ` Jonathan Nieder
2013-03-20 18:04 ` git merge <tag> behavior Yann Droneaud
2013-03-20 18:12 ` Yann Droneaud
2013-03-20 18:46 ` Junio C Hamano
2013-03-21 20:31 ` Max Nanasy
2013-03-22 9:16 ` Yann Droneaud
2013-03-22 10:09 ` [PATCH] t7600: test merge configuration override Yann Droneaud
2013-03-22 14:47 ` Junio C Hamano
2013-03-24 21:05 ` [PATCH 00/15] Use test_config Yann Droneaud
2013-03-24 21:06 ` [PATCH 01/15] t4018: remove test_config implementation Yann Droneaud
2013-03-24 21:06 ` [PATCH 02/15] t7810: " Yann Droneaud
2013-03-24 21:06 ` [PATCH 03/15] t7811: " Yann Droneaud
2013-03-24 21:06 ` [PATCH 04/15] t3400: use test_config to set/unset git config variables Yann Droneaud
2013-03-24 21:06 ` [PATCH 05/15] t4304: " Yann Droneaud
2013-03-24 21:06 ` [PATCH 06/15] t4034: use test_config/test_unconfig " Yann Droneaud
2013-03-24 21:06 ` [PATCH 07/15] t4202: " Yann Droneaud
2013-03-24 21:06 ` [PATCH 08/15] t5520: use test_config " Yann Droneaud
2013-03-24 21:06 ` [PATCH 09/15] t5541: " Yann Droneaud
2013-03-24 21:06 ` [PATCH 10/15] t7500: " Yann Droneaud
2013-03-24 21:06 ` [PATCH 11/15] t7502: " Yann Droneaud
2013-03-24 21:06 ` Yann Droneaud [this message]
2013-03-24 21:06 ` [PATCH 13/15] t7600: " Yann Droneaud
2013-03-24 21:06 ` [PATCH 14/15] t9500: " Yann Droneaud
2013-03-24 21:06 ` [PATCH 15/15] t7502: remove clear_config Yann Droneaud
2013-03-27 15:04 ` Junio C Hamano
2013-03-27 15:05 ` [PATCH 00/15] Use test_config Junio C Hamano
2013-03-27 16:19 ` Yann Droneaud
2013-03-22 15:23 ` git merge <tag> behavior Junio C Hamano
2013-03-22 10:57 ` [PATCH] t7600: merge tag shoud create a merge commit y
2013-03-22 14:48 ` Junio C Hamano
2013-03-22 14:56 ` Yann Droneaud
2013-03-22 15:05 ` Jeff King
2013-03-22 10:57 ` y
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b067bae5607f94705b4e12a1911bebc48ebb96f3.1364158574.git.ydroneaud@opteya.com \
--to=ydroneaud@opteya.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).