summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-07-06 20:38:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-07-06 20:38:11 (GMT)
commit1e4bf907890e094f1c1c8c5086387e7d5fdb0655 (patch)
tree50bf586083db40ec2dc4213110381f73e6d6c9dd /upload-pack.c
parent7a738b40f67fc44c2a2c1abcffe474241af3d30e (diff)
parent20b20a22f8f7c1420e259c97ef790cb93091f475 (diff)
downloadgit-1e4bf907890e094f1c1c8c5086387e7d5fdb0655.zip
git-1e4bf907890e094f1c1c8c5086387e7d5fdb0655.tar.gz
git-1e4bf907890e094f1c1c8c5086387e7d5fdb0655.tar.bz2
Merge branch 'jk/upload-pack-hook'
"upload-pack" allows a custom "git pack-objects" replacement when responding to "fetch/clone" via the uploadpack.packObjectsHook. * jk/upload-pack-hook: upload-pack: provide a hook for running pack-objects t1308: do not get fooled by symbolic links to the source tree config: add a notion of "scope" config: return configset value for current_config_ functions config: set up config_source for command-line config git_config_parse_parameter: refactor cleanup code git_config_with_options: drop "found" counting
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/upload-pack.c b/upload-pack.c
index a86d49c..f937870 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -56,6 +56,7 @@ static int keepalive = 5;
static int use_sideband;
static int advertise_refs;
static int stateless_rpc;
+static const char *pack_objects_hook;
static void reset_timeout(void)
{
@@ -98,6 +99,14 @@ static void create_pack_file(void)
int i;
FILE *pipe_fd;
+ if (!pack_objects_hook)
+ pack_objects.git_cmd = 1;
+ else {
+ argv_array_push(&pack_objects.args, pack_objects_hook);
+ argv_array_push(&pack_objects.args, "git");
+ pack_objects.use_shell = 1;
+ }
+
if (shallow_nr) {
argv_array_push(&pack_objects.args, "--shallow-file");
argv_array_push(&pack_objects.args, "");
@@ -120,7 +129,6 @@ static void create_pack_file(void)
pack_objects.in = -1;
pack_objects.out = -1;
pack_objects.err = -1;
- pack_objects.git_cmd = 1;
if (start_command(&pack_objects))
die("git upload-pack: unable to fork git-pack-objects");
@@ -813,6 +821,9 @@ static int upload_pack_config(const char *var, const char *value, void *unused)
keepalive = git_config_int(var, value);
if (!keepalive)
keepalive = -1;
+ } else if (current_config_scope() != CONFIG_SCOPE_REPO) {
+ if (!strcmp("uploadpack.packobjectshook", var))
+ return git_config_string(&pack_objects_hook, var, value);
}
return parse_hide_refs_config(var, value, "uploadpack");
}