summaryrefslogtreecommitdiff
path: root/builtin-archive.c
diff options
context:
space:
mode:
authorRene Scharfe <rene.scharfe@lsrfire.ath.cx>2008-07-25 12:41:25 +0200
committerJunio C Hamano <gitster@pobox.com>2008-07-25 17:28:40 -0700
commit819b2b58246a7927376930e266b4ef8b43096115 (patch)
tree88a5c97e19a048ebe86114db8a7ea27e3c47a112 /builtin-archive.c
parentf15f736d38d10f5c4f2ca367565019bdfe8e71dd (diff)
downloadgit-819b2b58246a7927376930e266b4ef8b43096115.tar.gz
archive: allow --exec and --remote without equal sign
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-archive.c')
-rw-r--r--builtin-archive.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/builtin-archive.c b/builtin-archive.c
index 4dd2716c0f..22445acbfc 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;