git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCHv2] Make filter-branch work with many branches

From
Dave Zarzycki <zarzycki@apple.com>
Date
Jul 20, 2011, 13:42 UTC
Message-ID
<CA809344-F7C2-4A41-B4F7-15B5EEB9B7E2@apple.com>

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
Next: Johannes Sixt
Message 1 of 2 in “[PATCHv2] Make filter-branch work with many branches”
  1. Dave ZarzyckiJul 20, 2011
  2. Johannes SixtJul 20, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.