Re: [PATCH] Add git-filter-branch
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 5, 2007, 10:30 UTC
- Message-ID
- <7vzm3ebsnk.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20070605101845.GA16160@diku.dk>
Jonas Fonseca <fonseca@diku.dk> writes:
Show 16 quoted lines
> $ git filter-branch H2 > /home/fonseca/bin/git-filter-branch: 386: arith: syntax error: "i+1" > $ > > A possible fix that makes the test pass for me. > > diff --git a/git-filter-branch.sh b/git-filter-branch.sh > index 0c8a7df..5cf9d3c 100644 > --- a/git-filter-branch.sh > +++ b/git-filter-branch.sh > @@ -339,7 +339,7 @@ test $commits -eq 0 && die "Found nothing to rewrite" > > i=0 > while read commit; do > - i=$((i+1)) > + i=$(echo i+1 | bc)
Are you sure this is not "echo $i+1"???
There are quite a few $((arithmetic)) already in our shell code, so I was initially a bit surprised. However, upon closer inspection, this particular use is not kosher at all.
The portable ones we already have in the code say things like:
msgnum=$(($msgnum+1))
The one in filter-branch that bit you does not dereference 'i'. I am reasonably sure if you fix it to read:
i=$(( $i+1 ))
dash would grok it.