Skip to content

Commit 01d40c8

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7884545 commit 01d40c8

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

list-objects-filter.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ struct filter_blobs_none_data {
3434
};
3535

3636
static enum list_objects_filter_result filter_blobs_none(
37+
struct repository *r,
3738
enum list_objects_filter_situation filter_situation,
3839
struct object *obj,
3940
const char *pathname,
@@ -88,6 +89,7 @@ struct filter_trees_none_data {
8889
};
8990

9091
static enum list_objects_filter_result filter_trees_none(
92+
struct repository *r,
9193
enum list_objects_filter_situation filter_situation,
9294
struct object *obj,
9395
const char *pathname,
@@ -144,6 +146,7 @@ struct filter_blobs_limit_data {
144146
};
145147

146148
static enum list_objects_filter_result filter_blobs_limit(
149+
struct repository *r,
147150
enum list_objects_filter_situation filter_situation,
148151
struct object *obj,
149152
const char *pathname,
@@ -171,7 +174,7 @@ static enum list_objects_filter_result filter_blobs_limit(
171174
assert(obj->type == OBJ_BLOB);
172175
assert((obj->flags & SEEN) == 0);
173176

174-
t = oid_object_info(the_repository, &obj->oid, &object_length);
177+
t = oid_object_info(r, &obj->oid, &object_length);
175178
if (t != OBJ_BLOB) { /* probably OBJ_NONE */
176179
/*
177180
* We DO NOT have the blob locally, so we cannot
@@ -249,6 +252,7 @@ struct filter_sparse_data {
249252
};
250253

251254
static enum list_objects_filter_result filter_sparse(
255+
struct repository *r,
252256
enum list_objects_filter_situation filter_situation,
253257
struct object *obj,
254258
const char *pathname,
@@ -268,7 +272,7 @@ static enum list_objects_filter_result filter_sparse(
268272
dtype = DT_DIR;
269273
val = is_excluded_from_list(pathname, strlen(pathname),
270274
filename, &dtype, &filter_data->el,
271-
&the_index);
275+
r->index);
272276
if (val < 0)
273277
val = filter_data->array_frame[filter_data->nr].defval;
274278

@@ -331,7 +335,7 @@ static enum list_objects_filter_result filter_sparse(
331335
dtype = DT_REG;
332336
val = is_excluded_from_list(pathname, strlen(pathname),
333337
filename, &dtype, &filter_data->el,
334-
&the_index);
338+
r->index);
335339
if (val < 0)
336340
val = frame->defval;
337341
if (val > 0) {

list-objects-filter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
struct list_objects_filter_options;
55
struct object;
66
struct oidset;
7+
struct repository;
78

89
/*
910
* During list-object traversal we allow certain objects to be
@@ -60,6 +61,7 @@ enum list_objects_filter_situation {
6061
};
6162

6263
typedef enum list_objects_filter_result (*filter_object_fn)(
64+
struct repository *r,
6365
enum list_objects_filter_situation filter_situation,
6466
struct object *obj,
6567
const char *pathname,

list-objects.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ static void process_blob(struct traversal_context *ctx,
5555
pathlen = path->len;
5656
strbuf_addstr(path, name);
5757
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,
5960
path->buf, &path->buf[pathlen],
6061
ctx->filter_data);
6162
if (r & LOFR_MARK_SEEN)
@@ -175,7 +176,8 @@ static void process_tree(struct traversal_context *ctx,
175176

176177
strbuf_addstr(base, name);
177178
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,
179181
base->buf, &base->buf[baselen],
180182
ctx->filter_data);
181183
if (r & LOFR_MARK_SEEN)
@@ -191,7 +193,8 @@ static void process_tree(struct traversal_context *ctx,
191193
process_tree_contents(ctx, tree, base);
192194

193195
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,
195198
base->buf, &base->buf[baselen],
196199
ctx->filter_data);
197200
if (r & LOFR_MARK_SEEN)

0 commit comments

Comments
 (0)