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

5 messages from 2007-08-29 to 2007-08-30. Participants: Johannes Schindelin, Matthieu Moy, Junio C Hamano.
Thread: https://gitlist.dev/t/9694

## Johannes Schindelin, 2007-08-29 16:52

Subject: [PATCH] t5701: "wc -l" may add whitespace
Message-ID: <Pine.LNX.4.64.0708291752050.28586@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0708291752050.28586%40racer.site

```

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

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, 2007-08-29 16:55

Subject: Re: [PATCH] t5701: "wc -l" may add whitespace
Message-ID: <vpqbqcqi8km.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqbqcqi8km.fsf%40bauges.imag.fr
In-Reply-To: <Pine.LNX.4.64.0708291752050.28586@racer.site>

```
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, 2007-08-29 17:00

Subject: Re: [PATCH] t5701: "wc -l" may add whitespace
Message-ID: <Pine.LNX.4.64.0708291759270.28586@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0708291759270.28586%40racer.site
In-Reply-To: <vpqbqcqi8km.fsf@bauges.imag.fr>

```
Hi,

On Wed, 29 Aug 2007, Matthieu Moy wrote:

> 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

```

## Junio C Hamano, 2007-08-30 06:13

Subject: Re: [PATCH] t5701: "wc -l" may add whitespace
Message-ID: <7vbqcpa6t6.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbqcpa6t6.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <Pine.LNX.4.64.0708291752050.28586@racer.site>

```
Isn't this already in as 70f64148bf7ca5136f2aa18c41b3b8f4bebfd138
(Fix t5701-clone-local for white space from wc)?

```

## Johannes Schindelin, 2007-08-30 09:26

Subject: Re: [PATCH] t5701: "wc -l" may add whitespace
Message-ID: <Pine.LNX.4.64.0708301026060.28586@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0708301026060.28586%40racer.site
In-Reply-To: <7vbqcpa6t6.fsf@gitster.siamese.dyndns.org>

```
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

```
