git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 5/6] archive: allow --exec and --remote without equal sign
Date: Fri, 25 Jul 2008 12:41:25 +0200	[thread overview]
Message-ID: <1216982486-5887-5-git-send-email-rene.scharfe@lsrfire.ath.cx> (raw)
In-Reply-To: <1216982486-5887-4-git-send-email-rene.scharfe@lsrfire.ath.cx>

Allow "--remote repo" and "--exec cmd" in addition to "--remote=repo" and
"--exec=cmd" to make their usage consistent with parameters handled by
parse_options().

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
 builtin-archive.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/builtin-archive.c b/builtin-archive.c
index 4dd2716..22445ac 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -15,7 +15,7 @@ static int run_remote_archiver(const char *remote, int argc,
 	int fd[2], i, len, rv;
 	struct child_process *conn;
 	const char *exec = "git-upload-archive";
-	int exec_at = 0;
+	int exec_at = 0, exec_value_at = 0;
 
 	for (i = 1; i < argc; i++) {
 		const char *arg = argv[i];
@@ -24,7 +24,14 @@ static int run_remote_archiver(const char *remote, int argc,
 				die("multiple --exec specified");
 			exec = arg + 7;
 			exec_at = i;
-			break;
+		} else if (!strcmp(arg, "--exec")) {
+			if (exec_at)
+				die("multiple --exec specified");
+			if (i + 1 >= argc)
+				die("option --exec requires a value");
+			exec = argv[i + 1];
+			exec_at = i;
+			exec_value_at = ++i;
 		}
 	}
 
@@ -32,7 +39,7 @@ static int run_remote_archiver(const char *remote, int argc,
 	conn = git_connect(fd, url, exec, 0);
 
 	for (i = 1; i < argc; i++) {
-		if (i == exec_at)
+		if (i == exec_at || i == exec_value_at)
 			continue;
 		packet_write(fd[1], "argument %s\n", argv[i]);
 	}
@@ -78,6 +85,13 @@ static const char *extract_remote_arg(int *ac, const char **av)
 					die("Multiple --remote specified");
 				remote = arg + 9;
 				continue;
+			} else if (!strcmp(arg, "--remote")) {
+				if (remote)
+					die("Multiple --remote specified");
+				if (++ix >= cnt)
+					die("option --remote requires a value");
+				remote = av[ix];
+				continue;
 			}
 			if (arg[0] != '-')
 				no_more_options = 1;
-- 
1.6.0.rc0.42.g186458

  reply	other threads:[~2008-07-25 10:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-25 10:41 [PATCH 1/6] archive: add write_archive() Rene Scharfe
2008-07-25 10:41 ` [PATCH 2/6] archive: move parameter parsing code to archive.c Rene Scharfe
2008-07-25 10:41   ` [PATCH 3/6] archive: define MAX_ARGS where it's needed Rene Scharfe
2008-07-25 10:41     ` [PATCH 4/6] archive: declare struct archiver " Rene Scharfe
2008-07-25 10:41       ` Rene Scharfe [this message]
2008-07-25 10:41         ` [PATCH 5/6] archive: allow --exec and --remote without equal sign Rene Scharfe
2008-07-25 10:54           ` René Scharfe
2008-07-26  0:31           ` Junio C Hamano
2008-07-26  7:09             ` PATCH 6/6] archive: convert,to parse_options() [was: [PATCH 5/6] archive: allow --exec and --remote without equal sign] René Scharfe
2008-07-26  0:28         ` [PATCH 5/6] archive: allow --exec and --remote without equal sign Junio C Hamano

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

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

  git send-email \
    --in-reply-to=1216982486-5887-5-git-send-email-rene.scharfe@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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.
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 NNTP newsgroup(s).