Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow git-filter-branch to process large repositories with lots of br…
…anches.

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 <Lee.Carver@servicenow.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Lee Carver authored and gitster committed Sep 12, 2013
1 parent 2ea3df6 commit 3361a54
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions git-filter-branch.sh
Expand Up @@ -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
"")
Expand All @@ -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 " ")

Expand Down

0 comments on commit 3361a54

Please sign in to comment.