{"thread":{"id":"7801","subject":"[PATCH] git-fetch: Fix Argument list too long","startedAt":"2007-04-23T19:26:26Z","lastAt":"2007-04-23T19:26:26Z","messageCount":1,"participants":["OGAWA Hirofumi"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"40232","messageId":"87wt02nb8d.fsf@duaron.myhome.or.jp","threadId":"7801","inReplyTo":null,"subject":"[PATCH] git-fetch: Fix Argument list too long","fromName":"OGAWA Hirofumi","fromEmail":"hirofumi@mail.parknet.co.jp","sentAt":"2007-04-23T19:26:26Z","receivedAt":"2007-04-23T19:26:26Z","isPatch":true,"sender":{"key":"hirofumi@mail.parknet.co.jp","avatar":null},"body":"If $ls_remote_result was too long,\n\n    git-fetch--tool -s pick-rref \"$rref\" \"$ls_remote_result\"\n\nin git-fetch will fail by \"Argument list too long\".\n\nThis patch fixes git-fetch--tool and git-fetch by reading\n$ls_remote_result from stdin.\n\nSigned-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>\n---\n builtin-fetch--tool.c |    6 +++++-\n git-fetch.sh          |   11 ++++++-----\n 2 files changed, 11 insertions(+), 6 deletions(-)\n\ndiff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c\nindex be341c1..3145c01 100644\n--- a/builtin-fetch--tool.c\n+++ b/builtin-fetch--tool.c\n@@ -571,9 +571,13 @@ int cmd_fetch__tool(int argc, const char **argv, const char *prefix)\n \t\treturn parse_reflist(reflist);\n \t}\n \tif (!strcmp(\"pick-rref\", argv[1])) {\n+\t\tconst char *ls_remote_result;\n \t\tif (argc != 4)\n \t\t\treturn error(\"pick-rref takes 2 args\");\n-\t\treturn pick_rref(sopt, argv[2], argv[3]);\n+\t\tls_remote_result = argv[3];\n+\t\tif (!strcmp(ls_remote_result, \"-\"))\n+\t\t\tls_remote_result = get_stdin();\n+\t\treturn pick_rref(sopt, argv[2], ls_remote_result);\n \t}\n \tif (!strcmp(\"expand-refs-wildcard\", argv[1])) {\n \t\tconst char *reflist;\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 832b20c..ea3c20d 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -189,8 +189,8 @@ fetch_all_at_once () {\n \t\t\t# See if all of what we are going to fetch are\n \t\t\t# connected to our repository's tips, in which\n \t\t\t# case we do not have to do any fetch.\n-\t\t\ttheirs=$(git-fetch--tool -s pick-rref \\\n-\t\t\t\t\t\"$rref\" \"$ls_remote_result\") &&\n+\t\t\ttheirs=$(echo \"$ls_remote_result\" | \\\n+\t\t\t\tgit-fetch--tool -s pick-rref \"$rref\" \"-\") &&\n \n \t\t\t# This will barf when $theirs reach an object that\n \t\t\t# we do not have in our repository.  Otherwise,\n@@ -198,7 +198,8 @@ fetch_all_at_once () {\n \t\t\tgit-rev-list --objects $theirs --not --all \\\n \t\t\t\t>/dev/null 2>/dev/null\n \t\tthen\n-\t\t\tgit-fetch--tool pick-rref \"$rref\" \"$ls_remote_result\"\n+\t\t\techo \"$ls_remote_result\" | \\\n+\t\t\t\tgit-fetch--tool pick-rref \"$rref\" \"-\"\n \t\telse\n \t\t\tgit-fetch-pack --thin $exec $keep $shallow_depth \\\n \t\t\t\t$quiet $no_progress \"$remote\" $rref ||\n@@ -263,8 +264,8 @@ fetch_per_ref () {\n \t  fi\n \n \t  # Find $remote_name from ls-remote output.\n-\t  head=$(git-fetch--tool -s pick-rref \\\n-\t\t\t\"$remote_name\" \"$ls_remote_result\")\n+\t  head=$(echo \"$ls_remote_result\" | \\\n+\t  \tgit-fetch--tool -s pick-rref \"$remote_name\" \"-\")\n \t  expr \"z$head\" : \"z$_x40\\$\" >/dev/null ||\n \t\tdie \"No such ref $remote_name at $remote\"\n \t  echo >&2 \"Fetching $remote_name from $remote using $proto\"\n-- \n1.5.2.rc0.1.g2cc31-dirty\n"}]}