git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: git@vger.kernel.org, Junio C Hamano <junkio@cox.net>
Subject: [PATCH] git-fetch: Fix Argument list too long
Date: Tue, 24 Apr 2007 04:26:26 +0900	[thread overview]
Message-ID: <87wt02nb8d.fsf@duaron.myhome.or.jp> (raw)

If $ls_remote_result was too long,

    git-fetch--tool -s pick-rref "$rref" "$ls_remote_result"

in git-fetch will fail by "Argument list too long".

This patch fixes git-fetch--tool and git-fetch by reading
$ls_remote_result from stdin.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
 builtin-fetch--tool.c |    6 +++++-
 git-fetch.sh          |   11 ++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index be341c1..3145c01 100644
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
@@ -571,9 +571,13 @@ int cmd_fetch__tool(int argc, const char **argv, const char *prefix)
 		return parse_reflist(reflist);
 	}
 	if (!strcmp("pick-rref", argv[1])) {
+		const char *ls_remote_result;
 		if (argc != 4)
 			return error("pick-rref takes 2 args");
-		return pick_rref(sopt, argv[2], argv[3]);
+		ls_remote_result = argv[3];
+		if (!strcmp(ls_remote_result, "-"))
+			ls_remote_result = get_stdin();
+		return pick_rref(sopt, argv[2], ls_remote_result);
 	}
 	if (!strcmp("expand-refs-wildcard", argv[1])) {
 		const char *reflist;
diff --git a/git-fetch.sh b/git-fetch.sh
index 832b20c..ea3c20d 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -189,8 +189,8 @@ fetch_all_at_once () {
 			# See if all of what we are going to fetch are
 			# connected to our repository's tips, in which
 			# case we do not have to do any fetch.
-			theirs=$(git-fetch--tool -s pick-rref \
-					"$rref" "$ls_remote_result") &&
+			theirs=$(echo "$ls_remote_result" | \
+				git-fetch--tool -s pick-rref "$rref" "-") &&
 
 			# This will barf when $theirs reach an object that
 			# we do not have in our repository.  Otherwise,
@@ -198,7 +198,8 @@ fetch_all_at_once () {
 			git-rev-list --objects $theirs --not --all \
 				>/dev/null 2>/dev/null
 		then
-			git-fetch--tool pick-rref "$rref" "$ls_remote_result"
+			echo "$ls_remote_result" | \
+				git-fetch--tool pick-rref "$rref" "-"
 		else
 			git-fetch-pack --thin $exec $keep $shallow_depth \
 				$quiet $no_progress "$remote" $rref ||
@@ -263,8 +264,8 @@ fetch_per_ref () {
 	  fi
 
 	  # Find $remote_name from ls-remote output.
-	  head=$(git-fetch--tool -s pick-rref \
-			"$remote_name" "$ls_remote_result")
+	  head=$(echo "$ls_remote_result" | \
+	  	git-fetch--tool -s pick-rref "$remote_name" "-")
 	  expr "z$head" : "z$_x40\$" >/dev/null ||
 		die "No such ref $remote_name at $remote"
 	  echo >&2 "Fetching $remote_name from $remote using $proto"
-- 
1.5.2.rc0.1.g2cc31-dirty

                 reply	other threads:[~2007-04-23 19:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wt02nb8d.fsf@duaron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).