From: Junio C Hamano Date: Thu, 17 Oct 2013 22:55:12 +0000 (-0700) Subject: Merge branch 'lc/filter-branch-too-many-refs' X-Git-Tag: v1.8.5-rc0~44 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f52752d36a98d0e5a70242d615d0f36f84936b45?ds=inline;hp=-c Merge branch 'lc/filter-branch-too-many-refs' "git filter-branch" in a repository with many refs blew limit of command line length. * lc/filter-branch-too-many-refs: Allow git-filter-branch to process large repositories with lots of branches. --- f52752d36a98d0e5a70242d615d0f36f84936b45 diff --combined git-filter-branch.sh index 98e8fe43d2,ca3d53919a..86d6994619 --- a/git-filter-branch.sh +++ b/git-filter-branch.sh @@@ -255,7 -255,7 +255,7 @@@ els 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 +268,7 @@@ 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,12 -283,11 +283,12 @@@ while read commit parents; d 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"