git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* t0090-cache-tree fails due to wc whitespace
@ 2011-12-14 14:35 Brian Gernhardt
  2011-12-14 14:57 ` Stefano Lattarini
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Brian Gernhardt @ 2011-12-14 14:35 UTC (permalink / raw)
  To: Git List; +Cc: Thomas Rast

It's time for my periodic complaint:  People assuming `wc -l` outputs just a number.  wc on OS X (and perhaps other BSD-like systems) always aligns the output in columns, even with the -l flag.  Generally this results in a quick patch from me to remove some unneeded quotes.  However, this time it's used in a more complex manner:

	echo "SHA " \
	    "($(git ls-files|wc -l) entries, 0 subtrees)" >expect &&
	cmp_cache_tree expect

This results in errors like:

--- expect	2011-12-14 14:26:26.000000000 +0000
+++ filtered	2011-12-14 14:26:26.000000000 +0000
@@ -1 +1 @@
-SHA  (       1 entries, 0 subtrees)
+SHA  (1 entries, 0 subtrees)

I was able to fix this by adding a sed command to remove leading spaces:

-           "($(git ls-files|wc -l) entries, 0 subtrees)" >expect &&
+           "($(git ls-files|wc -l|sed -e 's/^ *//') entries, 0 subtrees)" >expect &&

But I'm not sure if this is the best way to solve the issue.

~~ Brian Gernhardt

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-12-20  9:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-14 14:35 t0090-cache-tree fails due to wc whitespace Brian Gernhardt
2011-12-14 14:57 ` Stefano Lattarini
2011-12-14 15:09 ` Hallvard Breien Furuseth
2011-12-14 15:41 ` Johannes Sixt
2011-12-20  8:24   ` [PATCH] t0090: be prepared that 'wc -l' writes leading blanks Johannes Sixt
2011-12-20  9:17     ` Thomas Rast
2011-12-14 15:43 ` t0090-cache-tree fails due to wc whitespace Thomas Rast
2011-12-14 15:54   ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).