{"thread":{"id":"27865","subject":"[PATCHv2] Make filter-branch work with many branches","startedAt":"2011-07-20T13:42:37Z","lastAt":"2011-07-20T16:42:33Z","messageCount":2,"participants":["Dave Zarzycki","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"171738","messageId":"CA809344-F7C2-4A41-B4F7-15B5EEB9B7E2@apple.com","threadId":"27865","inReplyTo":null,"subject":"[PATCHv2] Make filter-branch work with many branches","fromName":"Dave Zarzycki","fromEmail":"zarzycki@apple.com","sentAt":"2011-07-20T13:42:37Z","receivedAt":"2011-07-20T13:42:37Z","isPatch":false,"sender":{"key":"zarzycki@apple.com","avatar":"https://avatars.githubusercontent.com/u/1071982?v=4"},"body":"When there are many branches, we can overflow the maximum number of\narguments to exec*().\n\nSigned-off-by: Dave Zarzycki <zarzycki@apple.com>\n---\n git-filter-branch.sh |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex 962a93b..a93e582 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -274,7 +274,7 @@ else\n \tremap_to_ancestor=t\n fi\n \n-rev_args=$(git rev-parse --revs-only \"$@\")\n+rev_parse_args=\"$@\"\n \n case \"$filter_subdir\" in\n \"\")\n@@ -286,8 +286,9 @@ case \"$filter_subdir\" in\n \t;;\n esac\n \n-git rev-list --reverse --topo-order --default HEAD \\\n-\t--parents --simplify-merges $rev_args \"$@\" > ../revs ||\n+git rev-parse --revs-only \"$rev_parse_args\" | git rev-list --stdin \\\n+\t--reverse --topo-order --default HEAD\t\\\n+\t--parents --simplify-merges \"$@\" > ../revs ||\n \tdie \"Could not get the commits\"\n commits=$(wc -l <../revs | tr -d \" \")\n \n-- \n1.7.6.235.gfdb98\n"},{"id":"171741","messageId":"4E270579.7060309@kdbg.org","threadId":"27865","inReplyTo":"CA809344-F7C2-4A41-B4F7-15B5EEB9B7E2@apple.com","subject":"Re: [PATCHv2] Make filter-branch work with many branches","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2011-07-20T16:42:33Z","receivedAt":"2011-07-20T16:42:33Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 20.07.2011 15:42, schrieb Dave Zarzycki:\n> -rev_args=$(git rev-parse --revs-only \"$@\")\n> +rev_parse_args=\"$@\"\n\nThis won't do what you expect when \"$@\" should expand to more than one\nword.\n\nI meant something like the following. Warning: Completely untested.\n\ndiff --git a/git-filter-branch.sh b/git-filter-branch.sh\nindex 962a93b..d0a933e 100755\n--- a/git-filter-branch.sh\n+++ b/git-filter-branch.sh\n@@ -274,7 +274,7 @@ else\n \tremap_to_ancestor=t\n fi\n \n-rev_args=$(git rev-parse --revs-only \"$@\")\n+git rev-parse --revs-only \"$@\" >../revargs || exit\n \n case \"$filter_subdir\" in\n \"\")\n@@ -287,7 +287,7 @@ case \"$filter_subdir\" in\n esac\n \n git rev-list --reverse --topo-order --default HEAD \\\n-\t--parents --simplify-merges $rev_args \"$@\" > ../revs ||\n+\t--parents --simplify-merges --stdin \"$@\" <../revargs >../revs ||\n \tdie \"Could not get the commits\"\n commits=$(wc -l <../revs | tr -d \" \")\n \n"}]}