git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] t/t5400-send-pack.sh: add test_when_finished commands

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jan 18, 2011, 21:41 UTC
Message-ID
<1295386896-21828-2-git-send-email-avarab@gmail.com>
In-Reply-To
<1295386896-21828-1-git-send-email-avarab@gmail.com>

Change the tests in t/t5400-send-pack.sh to use test_when_finished to unset git config variables that were set in the tests, e.g.:

    git config --unset $variable_they_set

This doesn't change the test behavior, but makes each test more self-contained.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t5400-send-pack.sh |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh
index 656ab1a..0357610 100755
--- a/t/t5400-send-pack.sh
+++ b/t/t5400-send-pack.sh
@@ -90,7 +90,8 @@ test_expect_success 'refuse deleting push with denyDeletes' '
 	    git config receive.denyDeletes true &&
 	    git branch extra master
 	) &&
-	test_must_fail git send-pack ./victim :extra master
+	test_must_fail git send-pack ./victim :extra master &&
+	test_when_finished "(cd victim && git config --unset receive.denyDeletes)"
 '
 
 test_expect_success 'cannot override denyDeletes with git -c send-pack' '
@@ -101,7 +102,8 @@ test_expect_success 'cannot override denyDeletes with git -c send-pack' '
 		git branch extra master
 	) &&
 	test_must_fail git -c receive.denyDeletes=false \
-					send-pack ./victim :extra master
+					send-pack ./victim :extra master &&
+	test_when_finished "(cd victim && git config --unset receive.denyDeletes)"
 '
 
 test_expect_success 'override denyDeletes with git -c receive-pack' '
@@ -125,7 +127,8 @@ test_expect_success 'denyNonFastforwards trumps --force' '
 	victim_orig=$(cd victim && git rev-parse --verify master) &&
 	test_must_fail git send-pack --force ./victim master^:master &&
 	victim_head=$(cd victim && git rev-parse --verify master) &&
-	test "$victim_orig" = "$victim_head"
+	test "$victim_orig" = "$victim_head" &&
+	test_when_finished "(cd victim && git config --unset receive.denyNonFastforwards)"
 '
 
 test_expect_success 'push --all excludes remote-tracking hierarchy' '
-- 
1.7.2.3
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 2 of 4 in “t/t5400-send-pack.sh: use the canonical test_expect_success syntax”
  1. 1/3 t/t5400-send-pack.sh: use the canonical test_expect_success syntaxÆvar Arnfjörð Bjarmason, Jan 18, 2011
  2. 2/3 t/t5400-send-pack.sh: add test_when_finished commandsÆvar Arnfjörð Bjarmason, Jan 18, 2011
  3. Junio C HamanoJan 18, 2011
  4. 3/3 t/t5400-send-pack.sh: re-indent subshell invocationÆvar Arnfjörð Bjarmason, Jan 18, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.