git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] t5521: fix and modernize
@ 2010-02-24 18:22 Junio C Hamano
  2010-02-24 18:22 ` [PATCH 2/2] builtin-fetch --all/--multi: propagate options correctly Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2010-02-24 18:22 UTC (permalink / raw)
  To: git

All of these tests were bogus, as they created new directory and tried to
run "git pull" without even running "git init" in there.  They were mucking
with the repository in $TEST_DIRECTORY.

While fixing it, modernize the style not to chdir around outside of
subshell.  Otherwise a failed test will take us to an unexpected directory
and we need to chdir back to the test directory in each test, which is
ugly and error prone.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t5521-pull-options.sh |   46 ++++++++++++++++++++--------------------------
 1 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
index 83e2e8a..c18d829 100755
--- a/t/t5521-pull-options.sh
+++ b/t/t5521-pull-options.sh
@@ -4,8 +4,6 @@ test_description='pull options'
 
 . ./test-lib.sh
 
-D=`pwd`
-
 test_expect_success 'setup' '
 	mkdir parent &&
 	(cd parent && git init &&
@@ -13,48 +11,44 @@ test_expect_success 'setup' '
 	 git commit -m one)
 '
 
-cd "$D"
-
 test_expect_success 'git pull -q' '
 	mkdir clonedq &&
-	cd clonedq &&
-	git pull -q "$D/parent" >out 2>err &&
-	test ! -s out
+	(cd clonedq && git init &&
+	git pull -q "../parent" >out 2>err &&
+	test ! -s err &&
+	test ! -s out)
 '
 
-cd "$D"
-
 test_expect_success 'git pull' '
 	mkdir cloned &&
-	cd cloned &&
-	git pull "$D/parent" >out 2>err &&
-	test -s out
+	(cd cloned && git init &&
+	git pull "../parent" >out 2>err &&
+	test -s err &&
+	test ! -s out)
 '
-cd "$D"
 
 test_expect_success 'git pull -v' '
 	mkdir clonedv &&
-	cd clonedv &&
-	git pull -v "$D/parent" >out 2>err &&
-	test -s out
+	(cd clonedv && git init &&
+	git pull -v "../parent" >out 2>err &&
+	test -s err &&
+	test ! -s out)
 '
 
-cd "$D"
-
 test_expect_success 'git pull -v -q' '
 	mkdir clonedvq &&
-	cd clonedvq &&
-	git pull -v -q "$D/parent" >out 2>err &&
-	test ! -s out
+	(cd clonedvq && git init &&
+	git pull -v -q "../parent" >out 2>err &&
+	test ! -s out &&
+	test ! -s err)
 '
 
-cd "$D"
-
 test_expect_success 'git pull -q -v' '
 	mkdir clonedqv &&
-	cd clonedqv &&
-	git pull -q -v "$D/parent" >out 2>err &&
-	test -s out
+	(cd clonedqv && git init &&
+	git pull -q -v "../parent" >out 2>err &&
+	test ! -s out &&
+	test -s err)
 '
 
 test_done
-- 
1.7.0.207.gac4ec

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-02-24 20:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-24 18:22 [PATCH 1/2] t5521: fix and modernize Junio C Hamano
2010-02-24 18:22 ` [PATCH 2/2] builtin-fetch --all/--multi: propagate options correctly Junio C Hamano
2010-02-24 19:02   ` [PATCH 3/3] fetch --all/--multiple: keep all the fetched branch information Junio C Hamano
2010-02-24 19:07     ` Teemu Likonen
2010-02-24 19:54     ` Michael Lukashov
2010-02-24 19:59       ` Junio C Hamano
2010-02-24 20:28         ` Michael Lukashov

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).