]> git.scripts.mit.edu Git - git.git/blobdiff - git-filter-branch.sh
interpret_branch_name: always respect "namelen" parameter
[git.git] / git-filter-branch.sh
index ac2a005fdb23c48d8451188ffd7b1c8194b0295f..86d6994619151fb63327848e6763b07971017ad7 100755 (executable)
@@ -255,7 +255,7 @@ else
        remap_to_ancestor=t
 fi
 
-rev_args=$(git rev-parse --revs-only "$@")
+git rev-parse --revs-only "$@" >../parse
 
 case "$filter_subdir" in
 "")
@@ -268,7 +268,7 @@ case "$filter_subdir" in
 esac
 
 git rev-list --reverse --topo-order --default HEAD \
-       --parents --simplify-merges $rev_args "$@" > ../revs ||
+       --parents --simplify-merges --stdin "$@" <../parse >../revs ||
        die "Could not get the commits"
 commits=$(wc -l <../revs | tr -d " ")
 
@@ -283,11 +283,12 @@ while read commit parents; do
 
        case "$filter_subdir" in
        "")
-               git read-tree -i -m $commit
+               GIT_ALLOW_NULL_SHA1=1 git read-tree -i -m $commit
                ;;
        *)
                # The commit may not have the subdirectory at all
-               err=$(git read-tree -i -m $commit:"$filter_subdir" 2>&1) || {
+               err=$(GIT_ALLOW_NULL_SHA1=1 \
+                     git read-tree -i -m $commit:"$filter_subdir" 2>&1) || {
                        if ! git rev-parse -q --verify $commit:"$filter_subdir"
                        then
                                rm -f "$GIT_INDEX_FILE"