git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] Make filter-branch work with many branches
@ 2011-07-20 13:42 Dave Zarzycki
  2011-07-20 16:42 ` Johannes Sixt
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Zarzycki @ 2011-07-20 13:42 UTC (permalink / raw)
  To: git

When there are many branches, we can overflow the maximum number of
arguments to exec*().

Signed-off-by: Dave Zarzycki <zarzycki@apple.com>
---
 git-filter-branch.sh |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 962a93b..a93e582 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -274,7 +274,7 @@ else
 	remap_to_ancestor=t
 fi
 
-rev_args=$(git rev-parse --revs-only "$@")
+rev_parse_args="$@"
 
 case "$filter_subdir" in
 "")
@@ -286,8 +286,9 @@ case "$filter_subdir" in
 	;;
 esac
 
-git rev-list --reverse --topo-order --default HEAD \
-	--parents --simplify-merges $rev_args "$@" > ../revs ||
+git rev-parse --revs-only "$rev_parse_args" | git rev-list --stdin \
+	--reverse --topo-order --default HEAD	\
+	--parents --simplify-merges "$@" > ../revs ||
 	die "Could not get the commits"
 commits=$(wc -l <../revs | tr -d " ")
 
-- 
1.7.6.235.gfdb98

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

* Re: [PATCHv2] Make filter-branch work with many branches
  2011-07-20 13:42 [PATCHv2] Make filter-branch work with many branches Dave Zarzycki
@ 2011-07-20 16:42 ` Johannes Sixt
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Sixt @ 2011-07-20 16:42 UTC (permalink / raw)
  To: Dave Zarzycki; +Cc: git

Am 20.07.2011 15:42, schrieb Dave Zarzycki:
> -rev_args=$(git rev-parse --revs-only "$@")
> +rev_parse_args="$@"

This won't do what you expect when "$@" should expand to more than one
word.

I meant something like the following. Warning: Completely untested.

diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 962a93b..d0a933e 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -274,7 +274,7 @@ else
 	remap_to_ancestor=t
 fi
 
-rev_args=$(git rev-parse --revs-only "$@")
+git rev-parse --revs-only "$@" >../revargs || exit
 
 case "$filter_subdir" in
 "")
@@ -287,7 +287,7 @@ case "$filter_subdir" in
 esac
 
 git rev-list --reverse --topo-order --default HEAD \
-	--parents --simplify-merges $rev_args "$@" > ../revs ||
+	--parents --simplify-merges --stdin "$@" <../revargs >../revs ||
 	die "Could not get the commits"
 commits=$(wc -l <../revs | tr -d " ")
 

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

end of thread, other threads:[~2011-07-20 16:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-20 13:42 [PATCHv2] Make filter-branch work with many branches Dave Zarzycki
2011-07-20 16:42 ` Johannes Sixt

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).