git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-rebase-interactive: avoid breaking when GREP_OPTIONS="-H"
@ 2009-09-07 12:56 Carlo Marcelo Arenas Belon
  2009-09-07 13:25 ` Dave Rodgman
  2009-09-07 19:37 ` Junio C Hamano
  0 siblings, 2 replies; 7+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2009-09-07 12:56 UTC (permalink / raw)
  To: git

if GREP_OPTIONS is set and includes -H, using `grep -c` will fail
to generate a numeric count and result in the following error :

  /usr/libexec/git-core/git-rebase--interactive: line 110: (standard
  input):1+(standard input):0: missing `)' (error token is
  "input):1+(standard input):0")

instead of grep counting use `wc -l` to return the line count.

Signed-off-by: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
---
 git-rebase--interactive.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 23ded48..c12d980 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -106,8 +106,8 @@ mark_action_done () {
 	sed -e 1q < "$TODO" >> "$DONE"
 	sed -e 1d < "$TODO" >> "$TODO".new
 	mv -f "$TODO".new "$TODO"
-	count=$(grep -c '^[^#]' < "$DONE")
-	total=$(($count+$(grep -c '^[^#]' < "$TODO")))
+	count=$(grep '^[^#]' < "$DONE" | wc -l)
+	total=$(($count+$(grep '^[^#]' < "$TODO" | wc -l)))
 	if test "$last_count" != "$count"
 	then
 		last_count=$count
-- 
1.6.3.3

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

end of thread, other threads:[~2009-09-08  8:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-07 12:56 [PATCH] git-rebase-interactive: avoid breaking when GREP_OPTIONS="-H" Carlo Marcelo Arenas Belon
2009-09-07 13:25 ` Dave Rodgman
2009-09-07 19:37 ` Junio C Hamano
2009-09-08  6:47   ` Carlo Marcelo Arenas Belon
2009-09-08  6:54     ` Junio C Hamano
2009-09-08  7:02   ` Junio C Hamano
2009-09-08  8:31     ` Carlo Marcelo Arenas Belon

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