threads / patch / 27854

patchMake filter-branch work with many branches

Subject: [PATCH] Make filter-branch work with many branches

## tl;dr

3 messages between Jul 19, 2011 and Jul 20, 2011. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Dave Zarzycki· Jul 19, 2011, 16:29 UTC · lore

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 |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
Show changes to git-filter-branch.sh +2 −4
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 962a93b..0c03db0 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -274,8 +274,6 @@ else
 	remap_to_ancestor=t
 fi
 
-rev_args=$(git rev-parse --revs-only "$@")
-
 case "$filter_subdir" in
 "")
 	eval set -- "$(git rev-parse --sq --no-revs "$@")"
@@ -286,8 +284,8 @@ case "$filter_subdir" in
 	;;
 esac
 
-git rev-list --reverse --topo-order --default HEAD \
-	--parents --simplify-merges $rev_args "$@" > ../revs ||
+git rev-parse --revs-only "$@" | 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.135.g8cdba
Johannes Sixt· Jul 19, 2011, 18:06 UTC · re: Dave Zarzycki · lore

Re: [PATCH] Make filter-branch work with many branches

Am 19.07.2011 18:29, schrieb Dave Zarzycki:
Show 5 quoted lines
> -rev_args=$(git rev-parse --revs-only "$@")
> -
>  case "$filter_subdir" in
>  "")
>  	eval set -- "$(git rev-parse --sq --no-revs "$@")"

This line in the hunk context changes what "$@" will produce. Therefore, the "$@" that you removed above will not produce the same thing...

Show 8 quoted lines
> @@ -286,8 +284,8 @@ case "$filter_subdir" in
>  	;;
>  esac
>  
> -git rev-list --reverse --topo-order --default HEAD \
> -	--parents --simplify-merges $rev_args "$@" > ../revs ||
> +git rev-parse --revs-only "$@" | git rev-list --stdin --reverse --topo-order \
> +	--default HEAD --parents --simplify-merges "$@" > ../revs ||
... that you insert here. How can the result ever have worked for you?
Perhaps store the list of revs in a temporary file?
-- Hannes
Dave Zarzycki· Jul 20, 2011, 13:34 UTC · re: Johannes Sixt · lore

Re: [PATCH] Make filter-branch work with many branches

On Jul 19, 2011, at 11:06 AM, Johannes Sixt wrote:
Show 9 quoted lines
> Am 19.07.2011 18:29, schrieb Dave Zarzycki:
>> -rev_args=$(git rev-parse --revs-only "$@")
>> -
>> case "$filter_subdir" in
>> "")
>> 	eval set -- "$(git rev-parse --sq --no-revs "$@")"
> 
> This line in the hunk context changes what "$@" will produce. Therefore,
> the "$@" that you removed above will not produce the same thing...
Thanks. My shell scripting is rather rusty these days. I'll send a new patch.
davez

← back to recent threads