Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2020-06-04 20:54:50 +0300
committerJunio C Hamano <gitster@pobox.com>2020-06-04 20:58:27 +0300
commit339a9840ef8258a75e07fee640ccceecd20ade31 (patch)
treea5967190201e20554ee2f22c672e94e9f0af0b9a /upload-pack.c
parente3835cd4bc6d727bf16a42229c0ca757c088e9d3 (diff)
upload-pack: move pack_objects_hook to upload_pack_data
As we cleanup 'upload-pack.c' by using 'struct upload_pack_data' more thoroughly, let's move the 'pack_objects_hook' static variable into this struct. It is used by code common to protocol v0 and protocol v2. While at it let's also free() it in upload_pack_data_clear(). Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 78b10a89ea..bc7e3ca19d 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -53,7 +53,6 @@ static timestamp_t oldest_have;
static unsigned int allow_unadvertised_object_request;
static int shallow_nr;
static struct object_array extra_edge_obj;
-static const char *pack_objects_hook;
/*
* Please annotate, and if possible group together, fields used only
@@ -88,6 +87,8 @@ struct upload_pack_data {
struct packet_writer writer;
+ const char *pack_objects_hook;
+
unsigned stateless_rpc : 1; /* v0 only */
unsigned no_done : 1; /* v0 only */
unsigned daemon_mode : 1; /* v0 only */
@@ -137,6 +138,8 @@ static void upload_pack_data_clear(struct upload_pack_data *data)
object_array_clear(&data->shallows);
string_list_clear(&data->deepen_not, 0);
list_objects_filter_release(&data->filter_options);
+
+ free((char *)data->pack_objects_hook);
}
static void reset_timeout(unsigned int timeout)
@@ -181,10 +184,10 @@ static void create_pack_file(struct upload_pack_data *pack_data)
int i;
FILE *pipe_fd;
- if (!pack_objects_hook)
+ if (!pack_data->pack_objects_hook)
pack_objects.git_cmd = 1;
else {
- argv_array_push(&pack_objects.args, pack_objects_hook);
+ argv_array_push(&pack_objects.args, pack_data->pack_objects_hook);
argv_array_push(&pack_objects.args, "git");
pack_objects.use_shell = 1;
}
@@ -1153,7 +1156,7 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data)
if (current_config_scope() != CONFIG_SCOPE_LOCAL &&
current_config_scope() != CONFIG_SCOPE_WORKTREE) {
if (!strcmp("uploadpack.packobjectshook", var))
- return git_config_string(&pack_objects_hook, var, value);
+ return git_config_string(&data->pack_objects_hook, var, value);
}
return parse_hide_refs_config(var, value, "uploadpack");