git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-v2] Allow git-filter-branch to process large repositories with lots of branches.
@ 2013-09-07 21:03 Lee Carver
  2013-09-07 23:06 ` Stefano Lattarini
  0 siblings, 1 reply; 7+ messages in thread
From: Lee Carver @ 2013-09-07 21:03 UTC (permalink / raw)
  To: Andreas Schwab, gitster@pobox.com, git@vger.kernel.org; +Cc: Lee Carver

As noted in several forums, a recommended way to move trees between
repositories
is to use git-filter-branch to revise the history for a single tree:

http://gbayer.com/development/moving-files-from-one-git-repository-to-anoth
er-preserving-history/
http://stackoverflow.com/questions/1365541/how-to-move-files-from-one-git-r
epo-to-another-not-a-clone-preserving-history

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

Piping the saved output from git rev-parse into git rev-list avoids this
problem, since the rev-parse output is not processed as a command line
argument.
---
 git-filter-branch.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ac2a005..60d239b 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -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
 "")
@@ -267,8 +267,9 @@ case "$filter_subdir" in
 	;;
 esac
 
+cat ../parse | \
 git rev-list --reverse --topo-order --default HEAD \
-	--parents --simplify-merges $rev_args "$@" > ../revs ||
+	--parents --simplify-merges --stdin "$@" > ../revs ||
 	die "Could not get the commits"
 commits=$(wc -l <../revs | tr -d " ")
 
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-12 17:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-07 21:03 [PATCH-v2] Allow git-filter-branch to process large repositories with lots of branches Lee Carver
2013-09-07 23:06 ` Stefano Lattarini
2013-09-10 22:55   ` [PATCH-v3] " Lee Carver
2013-09-10 23:20     ` Junio C Hamano
2013-09-11  0:21       ` Lee Carver
2013-09-11 16:06         ` Junio C Hamano
2013-09-12 17:46           ` [PATCH-v4] " Lee Carver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).