Code

git-filter-branch: avoid collisions with variables in eval'ed commands
authorElijah Newren <newren@gmail.com>
Wed, 25 Mar 2009 21:51:01 +0000 (15:51 -0600)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Mar 2009 23:35:52 +0000 (16:35 -0700)
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>
Acked-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-filter-branch.sh

index 20f6f5175070f62ab74eda4839c637afe1004d49..b90d3df3a7db97dbc8a16e9e73b705d52bf8fd20 100755 (executable)
@@ -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
        "")