git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: newren@gmail.com
To: pasky@suse.cz
Cc: git@vger.kernel.org, Johannes.Schindelin@gmx.de,
	gitster@pobox.com, Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH] git-filter-branch: avoid collisions with variables in eval'ed commands
Date: Wed, 25 Mar 2009 15:51:01 -0600	[thread overview]
Message-ID: <1238017861-15292-1-git-send-email-newren@gmail.com> (raw)
In-Reply-To: <51419b2c0903251433s75775206x556fc2d65a347d7d@mail.gmail.com>

From: Elijah Newren <newren@gmail.com>

Avoid using simple variable names like 'i', since user commands are eval'ed
and may clash with and overwrite our values.

Signed-off-by: Elijah Newren <newren@gmail.com>
---

If you have a different preference for the variable name, I'd be happy to
change it (again).  All I care about is avoiding conflicts with what people
might pass in their scripts.

 git-filter-branch.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 20f6f51..b90d3df 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -272,10 +272,10 @@ test $commits -eq 0 && die "Found nothing to rewrite"
 
 # Rewrite the commits
 
-i=0
+git_filter_branch__commit_count=0
 while read commit parents; do
-	i=$(($i+1))
-	printf "\rRewrite $commit ($i/$commits)"
+	git_filter_branch__commit_count=$(($git_filter_branch__commit_count+1))
+	printf "\rRewrite $commit ($git_filter_branch__commit_count/$commits)"
 
 	case "$filter_subdir" in
 	"")
-- 
1.6.0.6

  reply	other threads:[~2009-03-25 21:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-25 21:13 [PATCH] git-filter-branch: avoid collisions with variables in eval'ed commands newren
2009-03-25 21:24 ` Petr Baudis
2009-03-25 21:33   ` Elijah Newren
2009-03-25 21:51     ` newren [this message]
2009-03-25 21:58     ` Petr Baudis
2009-03-25 23:34       ` Junio C Hamano

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=1238017861-15292-1-git-send-email-newren@gmail.com \
    --to=newren@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pasky@suse.cz \
    /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).