git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-rebase-interactive: avoid breaking when GREP_OPTIONS="-H"

From
DRDave Rodgman <dav1dr@eml.cc>
Date
Sep 7, 2009, 13:25 UTC
Message-ID
<1252329924.15286.1333585269@webmail.messagingengine.com>
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:

Show 6 quoted lines
> 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
Show 30 quoted lines
> 
> 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
Previous: Carlo Marcelo Arenas BelonNext: Junio C Hamano
Message 2 of 7 in “git-rebase-interactive: avoid breaking when GREP_OPTIONS="-H"”
  1. git-rebase-interactive: avoid breaking when GREP_OPTIONS="-H"Carlo Marcelo Arenas Belon, Sep 7, 2009
  2. Dave RodgmanSep 7, 2009
  3. Junio C HamanoSep 7, 2009
  4. Carlo Marcelo Arenas BelonSep 8, 2009
  5. Junio C HamanoSep 8, 2009
  6. Junio C HamanoSep 8, 2009
  7. Carlo Marcelo Arenas BelonSep 8, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.