Code

Don't access line[-1] for a zero-length "line" from fgets.
[git.git] / git-filter-branch.sh
index 29d35fd27c52abf208f57e2a99d3de6e6ff2f977..ae29f47e41cde04599c22603173c8aaa4ef533d9 100755 (executable)
@@ -290,7 +290,7 @@ while read commit parents; do
                eval "$filter_tree" < /dev/null ||
                        die "tree filter failed: $filter_tree"
 
-               git diff-index -r $commit | cut -f 2- | tr '\n' '\0' | \
+               git diff-index -r $commit | cut -f 2- | tr '\012' '\000' | \
                        xargs -0 git update-index --add --replace --remove
                git ls-files -z --others | \
                        xargs -0 git update-index --add --replace --remove
@@ -342,7 +342,6 @@ done < "$tempdir"/heads
 
 _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
-count=0
 echo
 while read ref
 do
@@ -380,7 +379,6 @@ do
        ;;
        esac
        git update-ref -m "filter-branch: backup" "$orig_namespace$ref" $sha1
-       count=$(($count+1))
 done < "$tempdir"/heads
 
 # TODO: This should possibly go, with the semantics that all positive given
@@ -423,9 +421,6 @@ fi
 
 cd ../..
 rm -rf "$tempdir"
-echo
-test $count -gt 0 && echo "These refs were rewritten:"
-git show-ref | grep ^"$orig_namespace"
 
 unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
 test -z "$ORIG_GIT_DIR" || GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR