threads / patch / 9694

patcht5701: "wc -l" may add whitespace

Subject: [PATCH] t5701: "wc -l" may add whitespace

## tl;dr

5 messages between Aug 29, 2007 and Aug 30, 2007. Diffs are folded; open one to read it.

replies: 4people: 3as markdown or json

Johannes Schindelin· Aug 29, 2007, 16:52 UTC · lore
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	Found in msysGit... MSys' wc seems to suffer the same defect that 
	OSX' wc has...
 t/t5701-clone-local.sh |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
Show changes to t/t5701-clone-local.sh +2 −4
diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh
index d2f55eb..7e7019f 100755
--- a/t/t5701-clone-local.sh
+++ b/t/t5701-clone-local.sh
@@ -54,8 +54,7 @@ test_expect_success 'With -no-hardlinks, local will make a copy' '
 	cd "$D" &&
 	git clone --bare --no-hardlinks x w &&
 	cd w &&
-	linked=$(find objects -type f ! -links 1 | wc -l) &&
-	test "$linked" = 0
+	test $(find objects -type f ! -links 1 | wc -l) = 0
 '
 
 test_expect_success 'Even without -l, local will make a hardlink' '
@@ -63,8 +62,7 @@ test_expect_success 'Even without -l, local will make a hardlink' '
 	rm -fr w &&
 	git clone -l --bare x w &&
 	cd w &&
-	copied=$(find objects -type f -links 1 | wc -l) &&
-	test "$copied" = 0
+	test $(find objects -type f -links 1 | wc -l) = 0
 '
 
 test_done
-- 
1.5.3.rc7.2.g2d7f
Matthieu Moy· Aug 29, 2007, 16:55 UTC · re: Johannes Schindelin · lore

Re: [PATCH] t5701: "wc -l" may add whitespace

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> -	linked=$(find objects -type f ! -links 1 | wc -l) &&
> -	test "$linked" = 0
> +	test $(find objects -type f ! -links 1 | wc -l) = 0
You can also use "test x -eq y" to compare integers.
I don't know which one is the most portable.
-- 
Matthieu
Johannes Schindelin· Aug 29, 2007, 17:00 UTC · re: Matthieu Moy · lore

Re: [PATCH] t5701: "wc -l" may add whitespace

Hi,
On Wed, 29 Aug 2007, Matthieu Moy wrote:
Show 9 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > -	linked=$(find objects -type f ! -links 1 | wc -l) &&
> > -	test "$linked" = 0
> > +	test $(find objects -type f ! -links 1 | wc -l) = 0
> 
> You can also use "test x -eq y" to compare integers.
> 
> I don't know which one is the most portable.
Who cares when my version is obviously portable?

Ciao, Dscho

Johannes Schindelin· Aug 30, 2007, 09:26 UTC · re: Junio C Hamano · lore

Re: [PATCH] t5701: "wc -l" may add whitespace

Hi,
On Wed, 29 Aug 2007, Junio C Hamano wrote:
> Isn't this already in as 70f64148bf7ca5136f2aa18c41b3b8f4bebfd138
> (Fix t5701-clone-local for white space from wc)?

Argh. I get confused with those new-workdirs. (And it was necessary for 4msysgit, which lags behind again...) Sorry for the noise.

Ciao, Dscho

← back to recent threads