Skip to contentSkip to conversation

Mini bug report origin/pu: t1512 failed on Mac OS X (commit 957d74062c1f0e ?)

PATCH Torsten Bögershausen 4 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

The following tweak will make t1512 work on my Mac OS box:

t/t1512-rev-parse-disambiguation.sh +1 -1
@@ -257,7 +257,7 @@ test_expect_success 'rev-parse --disambiguate' '
        # commits created by commit-tree in earlier tests do not share
        # the prefix.
        git rev-parse --disambiguate=000000000 >actual &&
-       test "$(wc -l <actual)" = 16 &&
+       test "$(wc -l <actual)" -eq  16 &&
        test "$(sed -e "s/^\(.........\).*/\1/" actual | sort -u)" = 000000000
 
 

/Torsten

#1 lore raw

t/t1512-rev-parse-disambiguation.sh test_expect_success 'rev-parse --disambiguate' ' · line 260

Quoted 11 lines · Torsten Bögershausen

The following tweak will make t1512 work on my Mac OS box:

t/t1512-rev-parse-disambiguation.sh +1 -1
@@ -257,7 +257,7 @@ test_expect_success 'rev-parse --disambiguate' '
        # commits created by commit-tree in earlier tests do not share
        # the prefix.
        git rev-parse --disambiguate=000000000 >actual &&
-       test "$(wc -l <actual)" = 16 &&
+       test "$(wc -l <actual)" -eq  16 &&

I think the other tests in t/ prefer to unquote it so that we would ignore spaces around "wc -l" output, i.e.

	test $(wc -l <actual) = 16

Thanks for a report.

#2 lore raw
Quoted 6 lines · Junio C Hamano

I think the other tests in t/ prefer to unquote it so that we would ignore spaces around "wc -l" output, i.e.

	test $(wc -l <actual) = 16

Thanks for a report.

-- >8 --
Subject: [PATCH] t1512: ignore whitespaces in wc -l output

Some implementations of sed (e.g. MacOS X) have whitespaces in the output of "wc -l" that reads from the standard input. Ignore these whitespaces by not quoting the command substitution to be compared with the constant "16".

---
 t/t1512-rev-parse-disambiguation.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/t1512-rev-parse-disambiguation.sh +1 -1
index 3ed7558..1eb3514 100755
@@ -257,7 +257,7 @@ test_expect_success 'rev-parse --disambiguate' '
 	# commits created by commit-tree in earlier tests do not share
 	# the prefix.
 	git rev-parse --disambiguate=000000000 >actual &&
-	test "$(wc -l <actual)" = 16 &&
+	test $(wc -l <actual) = 16 &&
 	test "$(sed -e "s/^\(.........\).*/\1/" actual | sort -u)" = 000000000
 '
 
Signature · 1 line
1.7.11.2.270.gc2d3e4b
#3 lore raw

Am 7/12/2012 1:30, schrieb Junio C Hamano:

t/t1512-rev-parse-disambiguation.sh test_expect_success 'rev-parse --disambiguate' ' · line 260

Quoted 2 lines
t/t1512-rev-parse-disambiguation.sh +1 -1
-	test "$(wc -l <actual)" = 16 &&
+	test $(wc -l <actual) = 16 &&

We have a helper function for this:

	test_line_count = 16 actual &&

-- Hannes

#4 lore raw
Quoted 7 lines · Johannes Sixt

Am 7/12/2012 1:30, schrieb Junio C Hamano:

t/t1512-rev-parse-disambiguation.sh test_expect_success 'rev-parse --disambiguate' ' · line 260

Quoted 2 lines
t/t1512-rev-parse-disambiguation.sh +1 -1
-	test "$(wc -l <actual)" = 16 &&
+	test $(wc -l <actual) = 16 &&

We have a helper function for this:

	test_line_count = 16 actual &&

OK.

#5 lore raw
In reply to Junio C Hamano
Quoted 5 lines · Junio C Hamano
Quoted 3 lines · Junio C Hamano

I think the other tests in t/ prefer to unquote it so that we would ignore spaces around "wc -l" output, i.e.

Quoted 9 lines
Quoted 3 lines
	test $(wc -l <actual) = 16

Thanks for a report.

-- >8 --
Subject: [PATCH] t1512: ignore whitespaces in wc -l output

Some implementations of sed (e.g. MacOS X)

'sed'? Shouldn't this read 'wc'?

Quoted 3 lines

have whitespaces in the output of "wc -l" that reads from the standard input.

FYI, the extra space is present with Solaris wc as well:

$ wc -l </dev/null
       0

Regards,
Stefano

#6 lore raw
Quoted 8 lines · Stefano Lattarini
Quoted 7 lines · Junio C Hamano
Quoted 5 lines · Junio C Hamano

I think the other tests in t/ prefer to unquote it so that we would ignore spaces around "wc -l" output, i.e.

	test $(wc -l <actual) = 16
Quoted 8 lines
Quoted 7 lines
Quoted 1 line

Thanks for a report.

-- >8 --
Subject: [PATCH] t1512: ignore whitespaces in wc -l output

Some implementations of sed (e.g. MacOS X)

'sed'? Shouldn't this read 'wc'?

Heh, funny typo. I don't know what I was thinking.