@matheusbsbs / matheus-bagliano / commits / d23842fd53
Fork 0

rename --exec to --receive-pack for push and send-pack

For now it's just to get a more descriptive name. Later we might update the push protocol to run more than one program on the other end. Moreover this matches better the corresponding config option remote.<name>. receivepack. --exec continues to work Signed-off-by: Uwe Kleine-König <zeisberg@informatik.uni-freiburg.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Uwe Kleine-König committed Jan 19, 2007 at 13:49 UTC d23842fd53e61f32c189a6ec902c4133abf29878
4 files changed +32 -18
Documentation/git-push.txt
+5 -2
@@ -8,7 +8,7 @@ git-push - Update remote refs along with associated objects
8
9 SYNOPSIS
10 --------
11 -'git-push' [--all] [--tags] [--exec=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]
11 +'git-push' [--all] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]
12
13 DESCRIPTION
14 -----------
@@ -67,12 +67,15 @@ the remote repository.
67 addition to refspecs explicitly listed on the command
68 line.
69
70 -\--exec::
70 +\--receive-pack=<git-receive-pack>::
71 Path to the 'git-receive-pack' program on the remote
72 end. Sometimes useful when pushing to a remote
73 repository over ssh, and you do not have the program in
74 a directory on the default $PATH.
75
76 +\--exec=<git-receive-pack>::
77 + Same as \--receive-pack=<git-receive-pack>.
78 +
79 -f, \--force::
80 Usually, the command refuses to update a remote ref that is
81 not a descendant of the local ref used to overwrite it.
Documentation/git-send-pack.txt
+5 -2
@@ -8,7 +8,7 @@ git-send-pack - Push objects over git protocol to another reposiotory
8
9 SYNOPSIS
10 --------
11 -'git-send-pack' [--all] [--force] [--exec=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]
11 +'git-send-pack' [--all] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]
12
13 DESCRIPTION
14 -----------
@@ -21,12 +21,15 @@ updates it from the current repository, sending named refs.
21
22 OPTIONS
23 -------
24 -\--exec=<git-receive-pack>::
24 +\--receive-pack=<git-receive-pack>::
25 Path to the 'git-receive-pack' program on the remote
26 end. Sometimes useful when pushing to a remote
27 repository over ssh, and you do not have the program in
28 a directory on the default $PATH.
29
30 +\--exec=<git-receive-pack>::
31 + Same as \--receive-pack=<git-receive-pack>.
32 +
33 \--all::
34 Instead of explicitly specifying which refs to update,
35 update all refs that locally exist.
builtin-push.c
+14 -10
@@ -8,10 +8,10 @@
8
9 #define MAX_URI (16)
10
11 -static const char push_usage[] = "git-push [--all] [--tags] [--exec=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]";
11 +static const char push_usage[] = "git-push [--all] [--tags] [--receive-pack=<git-receive-pack>] [--repo=all] [-f | --force] [-v] [<repository> <refspec>...]";
12
13 static int all, tags, force, thin = 1, verbose;
14 -static const char *execute;
14 +static const char *receivepack;
15
16 #define BUF_SIZE (2084)
17 static char buffer[BUF_SIZE];
@@ -160,10 +160,10 @@ static int get_remote_config(const char* key, const char* value)
160 add_refspec(xstrdup(value));
161 else if (config_get_receivepack &&
162 !strcmp(key + 7 + config_repo_len, ".receivepack")) {
163 - if (!execute) {
164 - char *ex = xmalloc(strlen(value) + 8);
165 - sprintf(ex, "--exec=%s", value);
166 - execute = ex;
163 + if (!receivepack) {
164 + char *rp = xmalloc(strlen(value) + 16);
165 + sprintf(rp, "--receive-pack=%s", value);
166 + receivepack = rp;
167 } else
168 error("more than one receivepack given, using the first");
169 }
@@ -178,7 +178,7 @@ static int get_config_remotes_uri(const char *repo, const char *uri[MAX_URI])
178 config_current_uri = 0;
179 config_uri = uri;
180 config_get_refspecs = !(refspec_nr || all || tags);
181 - config_get_receivepack = (execute == NULL);
181 + config_get_receivepack = (receivepack == NULL);
182
183 git_config(get_remote_config);
184 return config_current_uri;
@@ -263,8 +263,8 @@ static int do_push(const char *repo)
263 argv[argc++] = "--all";
264 if (force)
265 argv[argc++] = "--force";
266 - if (execute)
267 - argv[argc++] = execute;
266 + if (receivepack)
267 + argv[argc++] = receivepack;
268 common_argc = argc;
269
270 for (i = 0; i < n; i++) {
@@ -347,8 +347,12 @@ int cmd_push(int argc, const char **argv, const char *prefix)
347 thin = 0;
348 continue;
349 }
350 + if (!strncmp(arg, "--receive-pack=", 15)) {
351 + receivepack = arg;
352 + continue;
353 + }
354 if (!strncmp(arg, "--exec=", 7)) {
351 - execute = arg;
355 + receivepack = arg;
356 continue;
357 }
358 usage(push_usage);
send-pack.c
+8 -4
@@ -6,9 +6,9 @@
6 #include "exec_cmd.h"
7
8 static const char send_pack_usage[] =
9 -"git-send-pack [--all] [--force] [--exec=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]\n"
9 +"git-send-pack [--all] [--force] [--receive-pack=<git-receive-pack>] [--verbose] [--thin] [<host>:]<directory> [<ref>...]\n"
10 " --all and explicit <ref> specification are mutually exclusive.";
11 -static const char *exec = "git-receive-pack";
11 +static const char *receivepack = "git-receive-pack";
12 static int verbose;
13 static int send_all;
14 static int force_update;
@@ -377,8 +377,12 @@ int main(int argc, char **argv)
377 char *arg = *argv;
378
379 if (*arg == '-') {
380 + if (!strncmp(arg, "--receive-pack=", 15)) {
381 + receivepack = arg + 15;
382 + continue;
383 + }
384 if (!strncmp(arg, "--exec=", 7)) {
381 - exec = arg + 7;
385 + receivepack = arg + 7;
386 continue;
387 }
388 if (!strcmp(arg, "--all")) {
@@ -413,7 +417,7 @@ int main(int argc, char **argv)
417 usage(send_pack_usage);
418 verify_remote_names(nr_heads, heads);
419
416 - pid = git_connect(fd, dest, exec);
420 + pid = git_connect(fd, dest, receivepack);
421 if (pid < 0)
422 return 1;
423 ret = send_pack(fd[0], fd[1], nr_heads, heads);