git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dave Rodgman" <dav1dr@eml.cc>
To: "Carlo Marcelo Arenas Belon" <carenas@sajinet.com.pe>,
	git@vger.kernel.org
Subject: Re: [PATCH] git-rebase-interactive: avoid breaking when GREP_OPTIONS="-H"
Date: Mon, 07 Sep 2009 14:25:24 +0100	[thread overview]
Message-ID: <1252329924.15286.1333585269@webmail.messagingengine.com> (raw)
In-Reply-To: <1252328160-4359-1-git-send-email-carenas@sajinet.com.pe>



On Mon, 07 Sep 2009 05:56 -0700, "Carlo Marcelo Arenas Belon"
<carenas@sajinet.com.pe> wrote:
> 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")

I think in my case, grep is being confused by colours being enabled - I
have this wrapper script
for grep:

#!/bin/bash
echo $@
`which -a grep|/bin/grep -v $0|head -n 1` --color=auto $@

your patch fixes it though.

thanks

Dave

> 
> 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
> 
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-09-07 13:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1252329924.15286.1333585269@webmail.messagingengine.com \
    --to=dav1dr@eml.cc \
    --cc=carenas@sajinet.com.pe \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).