Re: [PATCH] Add more tests for git-clean

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Add more tests for git-clean

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:47

Shawn Bohrer [off-list ref] writes:
+test_expect_success 'git-clean with prefix' '
+
+	mkdir -p build docs &&
+	touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+	cd src/ &&
+	git-clean &&
+	cd - &&
This is wrong for two reasons.

 - Is "cd -" portable?

 - What happens when git-clean fails?  This test fails, and then
   it goes on to the next test without cd'ing back.

Re: [PATCH] Add more tests for git-clean

From: Pierre Habouzit <hidden>
Date: 2016-06-15 22:43:47

On Sun, Nov 04, 2007 at 11:35:42PM +0000, Junio C Hamano wrote:
Shawn Bohrer [off-list ref] writes:
quoted
+test_expect_success 'git-clean with prefix' '
+
+	mkdir -p build docs &&
+	touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+	cd src/ &&
+	git-clean &&
+	cd - &&
This is wrong for two reasons.

 - Is "cd -" portable?
  this is POSIX:

8910 − When a hyphen is used as the operand, this shall be equivalent to the command:
8911   cd "$OLDPWD" && pwd
8912   which changes to the previous working directory and then writes its name.

  Meaning that cd $OLDPWD should work, and won't print $OLDPWD.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Re: [PATCH] Add more tests for git-clean

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:43:47

Hi,

On Sun, 4 Nov 2007, Junio C Hamano wrote:
Shawn Bohrer [off-list ref] writes:
quoted
+test_expect_success 'git-clean with prefix' '
+
+	mkdir -p build docs &&
+	touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
+	cd src/ &&
+	git-clean &&
+	cd - &&
This is wrong for two reasons.

 - Is "cd -" portable?

 - What happens when git-clean fails?  This test fails, and then
   it goes on to the next test without cd'ing back.
So it should be

	(cd src/ && git clean) &&

right?  (Note that I also removed the dash, since it will be a builtin 
after the next commit.)

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help