68
static int filter_capability_requested;
69
static int allow_filter;
70
static int allow_ref_in_want;
71
-static struct list_objects_filter_options filter_options;
71
72
static int allow_sideband_all;
73
102
}
103
104
static void create_pack_file(const struct object_array *have_obj,
106
- const struct object_array *want_obj)
105
+ const struct object_array *want_obj,
106
+ struct list_objects_filter_options *filter_options)
107
{
108
struct child_process pack_objects = CHILD_PROCESS_INIT;
109
char data[8193], progress[128];
140
argv_array_push(&pack_objects.args, "--delta-base-offset");
141
if (use_include_tag)
142
argv_array_push(&pack_objects.args, "--include-tag");
143
- if (filter_options.choice) {
143
+ if (filter_options->choice) {
144
const char *spec =
145
- expand_list_objects_filter_spec(&filter_options);
145
+ expand_list_objects_filter_spec(filter_options);
146
if (pack_objects.use_shell) {
147
struct strbuf buf = STRBUF_INIT;
148
sq_quote_buf(&buf, spec);
848
return 0;
849
}
850
851
-static void receive_needs(struct packet_reader *reader, struct object_array *want_obj)
851
+static void receive_needs(struct packet_reader *reader,
852
+ struct object_array *want_obj,
853
+ struct list_objects_filter_options *filter_options)
854
{
855
struct object_array shallows = OBJECT_ARRAY_INIT;
856
struct string_list deepen_not = STRING_LIST_INIT_DUP;
885
if (skip_prefix(reader->line, "filter ", &arg)) {
886
if (!filter_capability_requested)
887
die("git upload-pack: filtering capability not negotiated");
886
- list_objects_filter_die_if_populated(&filter_options);
887
- parse_list_objects_filter(&filter_options, arg);
888
+ list_objects_filter_die_if_populated(filter_options);
889
+ parse_list_objects_filter(filter_options, arg);
890
continue;
891
}
892
1089
struct string_list symref = STRING_LIST_INIT_DUP;
1090
struct object_array want_obj = OBJECT_ARRAY_INIT;
1091
struct packet_reader reader;
1092
+ struct list_objects_filter_options filter_options;
1093
1094
stateless_rpc = options->stateless_rpc;
1095
timeout = options->timeout;
1096
daemon_mode = options->daemon_mode;
1097
1098
+ memset(&filter_options, 0, sizeof(filter_options));
1099
+
1100
git_config(upload_pack_config, NULL);
1101
1102
head_ref_namespaced(find_symref, &symref);
1119
PACKET_READ_CHOMP_NEWLINE |
1120
PACKET_READ_DIE_ON_ERR_PACKET);
1121
1117
- receive_needs(&reader, &want_obj);
1122
+ receive_needs(&reader, &want_obj, &filter_options);
1123
if (want_obj.nr) {
1124
struct object_array have_obj = OBJECT_ARRAY_INIT;
1125
get_common_commits(&reader, &have_obj, &want_obj);
1121
- create_pack_file(&have_obj, &want_obj);
1126
+ create_pack_file(&have_obj, &want_obj, &filter_options);
1127
}
1128
+
1129
+ list_objects_filter_release(&filter_options);
1130
}
1131
1132
struct upload_pack_data {
1141
int deepen_rev_list;
1142
int deepen_relative;
1143
1144
+ struct list_objects_filter_options filter_options;
1145
+
1146
struct packet_writer writer;
1147
1148
unsigned stateless_rpc : 1;
1178
oid_array_clear(&data->haves);
1179
object_array_clear(&data->shallows);
1180
string_list_clear(&data->deepen_not, 0);
1181
+ list_objects_filter_release(&data->filter_options);
1182
}
1183
1184
static int parse_want(struct packet_writer *writer, const char *line,
1316
}
1317
1318
if (allow_filter && skip_prefix(arg, "filter ", &p)) {
1309
- list_objects_filter_die_if_populated(&filter_options);
1310
- parse_list_objects_filter(&filter_options, p);
1319
+ list_objects_filter_die_if_populated(&data->filter_options);
1320
+ parse_list_objects_filter(&data->filter_options, p);
1321
continue;
1322
}
1323
1521
send_shallow_info(&data, &want_obj);
1522
1523
packet_writer_write(&data.writer, "packfile\n");
1514
- create_pack_file(&have_obj, &want_obj);
1524
+ create_pack_file(&have_obj, &want_obj, &data.filter_options);
1525
state = FETCH_DONE;
1526
break;
1527
case FETCH_DONE: