list-objects-filter.c: remove implicit dependency on the_index

While at there, since we have access to struct repository now, eliminate the only the_repository reference in this file. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Nov 10, 2018 at 06:48 UTC 01d40c8487f62476e722f30ba252359b59f35c33
3 files changed +15 -6
list-objects-filter.c
+7 -3
@@ -34,6 +34,7 @@ struct filter_blobs_none_data {
34 };
35
36 static enum list_objects_filter_result filter_blobs_none(
37 + struct repository *r,
38 enum list_objects_filter_situation filter_situation,
39 struct object *obj,
40 const char *pathname,
@@ -88,6 +89,7 @@ struct filter_trees_none_data {
89 };
90
91 static enum list_objects_filter_result filter_trees_none(
92 + struct repository *r,
93 enum list_objects_filter_situation filter_situation,
94 struct object *obj,
95 const char *pathname,
@@ -144,6 +146,7 @@ struct filter_blobs_limit_data {
146 };
147
148 static enum list_objects_filter_result filter_blobs_limit(
149 + struct repository *r,
150 enum list_objects_filter_situation filter_situation,
151 struct object *obj,
152 const char *pathname,
@@ -171,7 +174,7 @@ static enum list_objects_filter_result filter_blobs_limit(
174 assert(obj->type == OBJ_BLOB);
175 assert((obj->flags & SEEN) == 0);
176
174 - t = oid_object_info(the_repository, &obj->oid, &object_length);
177 + t = oid_object_info(r, &obj->oid, &object_length);
178 if (t != OBJ_BLOB) { /* probably OBJ_NONE */
179 /*
180 * We DO NOT have the blob locally, so we cannot
@@ -249,6 +252,7 @@ struct filter_sparse_data {
252 };
253
254 static enum list_objects_filter_result filter_sparse(
255 + struct repository *r,
256 enum list_objects_filter_situation filter_situation,
257 struct object *obj,
258 const char *pathname,
@@ -268,7 +272,7 @@ static enum list_objects_filter_result filter_sparse(
272 dtype = DT_DIR;
273 val = is_excluded_from_list(pathname, strlen(pathname),
274 filename, &dtype, &filter_data->el,
271 - &the_index);
275 + r->index);
276 if (val < 0)
277 val = filter_data->array_frame[filter_data->nr].defval;
278
@@ -331,7 +335,7 @@ static enum list_objects_filter_result filter_sparse(
335 dtype = DT_REG;
336 val = is_excluded_from_list(pathname, strlen(pathname),
337 filename, &dtype, &filter_data->el,
334 - &the_index);
338 + r->index);
339 if (val < 0)
340 val = frame->defval;
341 if (val > 0) {
list-objects-filter.h
+2
@@ -4,6 +4,7 @@
4 struct list_objects_filter_options;
5 struct object;
6 struct oidset;
7 +struct repository;
8
9 /*
10 * During list-object traversal we allow certain objects to be
@@ -60,6 +61,7 @@ enum list_objects_filter_situation {
61 };
62
63 typedef enum list_objects_filter_result (*filter_object_fn)(
64 + struct repository *r,
65 enum list_objects_filter_situation filter_situation,
66 struct object *obj,
67 const char *pathname,
list-objects.c
+6 -3
@@ -55,7 +55,8 @@ static void process_blob(struct traversal_context *ctx,
55 pathlen = path->len;
56 strbuf_addstr(path, name);
57 if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)
58 - r = ctx->filter_fn(LOFS_BLOB, obj,
58 + r = ctx->filter_fn(ctx->revs->repo,
59 + LOFS_BLOB, obj,
60 path->buf, &path->buf[pathlen],
61 ctx->filter_data);
62 if (r & LOFR_MARK_SEEN)
@@ -175,7 +176,8 @@ static void process_tree(struct traversal_context *ctx,
176
177 strbuf_addstr(base, name);
178 if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn)
178 - r = ctx->filter_fn(LOFS_BEGIN_TREE, obj,
179 + r = ctx->filter_fn(ctx->revs->repo,
180 + LOFS_BEGIN_TREE, obj,
181 base->buf, &base->buf[baselen],
182 ctx->filter_data);
183 if (r & LOFR_MARK_SEEN)
@@ -191,7 +193,8 @@ static void process_tree(struct traversal_context *ctx,
193 process_tree_contents(ctx, tree, base);
194
195 if ((obj->flags & NOT_USER_GIVEN) && ctx->filter_fn) {
194 - r = ctx->filter_fn(LOFS_END_TREE, obj,
196 + r = ctx->filter_fn(ctx->revs->repo,
197 + LOFS_END_TREE, obj,
198 base->buf, &base->buf[baselen],
199 ctx->filter_data);
200 if (r & LOFR_MARK_SEEN)