Skip to content

Commit 3361a54

Browse files
Lee Carvergitster
authored andcommitted
Allow git-filter-branch to process large repositories with lots of branches.
A recommended way to move trees between repositories is to use git-filter-branch to revise the history for a single tree: However, this can lead to "argument list too long" errors when the original repository has many retained branches (>6k) /usr/local/git/libexec/git-core/git-filter-branch: line 270: /usr/local/git/libexec/git-core/git: Argument list too long Could not get the commits Saving the output from rev-parse and feeding it into rev-list from its standard input avoids this problem, since the rev-parse output is not processed as a command line argument. Signed-off-by: Lee Carver <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2ea3df6 commit 3361a54

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

git-filter-branch.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ else
255255
remap_to_ancestor=t
256256
fi
257257

258-
rev_args=$(git rev-parse --revs-only "$@")
258+
git rev-parse --revs-only "$@" >../parse
259259

260260
case "$filter_subdir" in
261261
"")
@@ -268,7 +268,7 @@ case "$filter_subdir" in
268268
esac
269269

270270
git rev-list --reverse --topo-order --default HEAD \
271-
--parents --simplify-merges $rev_args "$@" > ../revs ||
271+
--parents --simplify-merges --stdin "$@" <../parse >../revs ||
272272
die "Could not get the commits"
273273
commits=$(wc -l <../revs | tr -d " ")
274274

0 commit comments

Comments
 (0)