Skip to contentSkip to conversation

Fix t5516-fetch for systems where `wc -l` outputs whitespace.

PATCH New Brian Gernhardt 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix t5516-fetch for systems where `wc -l` outputs whitespace.

When wc outputs whitespace, the test "$(command | wc -l)" = 1 is
broken because " 1" != "1". Let the shell eat the whitespace by
using test 1 = $(command | wc -l) instead.

---

As per the previous discussion on the list.

 t/t5516-fetch-push.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
t/t5516-fetch-push.sh +2 -2
index 08d58e1..c0fa2ba 100755
@@ -226,7 +226,7 @@ test_expect_success 'push with colon-less refspec (3)' '
 	git branch -f frotz master &&
 	git push testrepo frotz &&
 	check_push_result $the_commit heads/frotz &&
-	test "$( cd testrepo && git show-ref | wc -l )" = 1
+	test 1 = $( cd testrepo && git show-ref | wc -l )
 '
 
 test_expect_success 'push with colon-less refspec (4)' '
@@ -239,7 +239,7 @@ test_expect_success 'push with colon-less refspec (4)' '
 	git tag -f frotz &&
 	git push testrepo frotz &&
 	check_push_result $the_commit tags/frotz &&
-	test "$( cd testrepo && git show-ref | wc -l )" = 1
+	test 1 = $( cd testrepo && git show-ref | wc -l )
 
 '
 
Signature · 1 line
1.5.2.2.590.gf578-dirty