make --exec=... option to git-push configurable
Having to specify git push --exec=... is annoying if you cannot have git-receivepack in your PATH on the remote side (or don't want to). This introduces the config item remote.<name>.receivepack to override the default value (which is "git-receive-pack"). 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:46 UTC
060aafc11fb6140f1b33326f03e70dad5762a624
2 files changed
+15
Documentation/config.txt
+4
@@ -356,6 +356,10 @@ remote.<name>.push::
356
The default set of "refspec" for gitlink:git-push[1]. See
357
gitlink:git-push[1].
358
359
+remote.<name>.receivepack::
360
+ The default program to execute on the remote side when pulling. See
361
+ option \--exec of gitlink:git-push[1].
362
+
363
repack.usedeltabaseoffset::
364
Allow gitlink:git-repack[1] to create packs that uses
365
delta-base offset. Defaults to false.
builtin-push.c
+11
@@ -143,6 +143,7 @@ static const char *config_repo;
143
static int config_repo_len;
144
static int config_current_uri;
145
static int config_get_refspecs;
146
+static int config_get_receivepack;
147
148
static int get_remote_config(const char* key, const char* value)
149
{
@@ -157,6 +158,15 @@ static int get_remote_config(const char* key, const char* value)
158
else if (config_get_refspecs &&
159
!strcmp(key + 7 + config_repo_len, ".push"))
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;
167
+ } else
168
+ error("more than one receivepack given, using the first");
169
+ }
170
}
171
return 0;
172
}
@@ -168,6 +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);
182
183
git_config(get_remote_config);
184
return config_current_uri;