Subject: [PATCH 03/19] list-objects-filter.c: remove implicit dependency on the_index

From: Nguyễn Thái Ngọc Duy <[email-masked]>
Date: Fri, 19 Oct 2018 16:52:21 +0200

Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
---
 list-objects-filter.c | 7 +++++--
 list-objects-filter.h | 1 +
 list-objects.c        | 3 +++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/list-objects-filter.c b/list-objects-filter.c
index a0ba78b20c..8825e2a5ab 100644
--- a/list-objects-filter.c
+++ b/list-objects-filter.c
@@ -38,6 +38,7 @@ static enum list_objects_filter_result filter_blobs_none(
 	struct object *obj,
 	const char *pathname,
 	const char *filename,
+	struct index_state *istate,
 	void *filter_data_)
 {
 	struct filter_blobs_none_data *filter_data = filter_data_;
@@ -94,6 +95,7 @@ static enum list_objects_filter_result filter_blobs_limit(
 	struct object *obj,
 	const char *pathname,
 	const char *filename,
+	struct index_state *istate,
 	void *filter_data_)
 {
 	struct filter_blobs_limit_data *filter_data = filter_data_;
@@ -200,6 +202,7 @@ static enum list_objects_filter_result filter_sparse(
 	struct object *obj,
 	const char *pathname,
 	const char *filename,
+	struct index_state *istate,
 	void *filter_data_)
 {
 	struct filter_sparse_data *filter_data = filter_data_;
@@ -216,7 +219,7 @@ static enum list_objects_filter_result filter_sparse(
 		dtype = DT_DIR;
 		val = is_excluded_from_list(pathname, strlen(pathname),
 					    filename, &dtype, &filter_data->el,
-					    &the_index);
+					    istate);
 		if (val < 0)
 			val = filter_data->array_frame[filter_data->nr].defval;
 
@@ -279,7 +282,7 @@ static enum list_objects_filter_result filter_sparse(
 		dtype = DT_REG;
 		val = is_excluded_from_list(pathname, strlen(pathname),
 					    filename, &dtype, &filter_data->el,
-					    &the_index);
+					    istate);
 		if (val < 0)
 			val = frame->defval;
 		if (val > 0) {
diff --git a/list-objects-filter.h b/list-objects-filter.h
index a6f6b4990b..dfa29595d1 100644
--- a/list-objects-filter.h
+++ b/list-objects-filter.h
@@ -58,6 +58,7 @@ typedef enum list_objects_filter_result (*filter_object_fn)(
 	struct object *obj,
 	const char *pathname,
 	const char *filename,
+	struct index_state *istate,
 	void *filter_data);
 
 typedef void (*filter_free_fn)(void *filter_data);
diff --git a/list-objects.c b/list-objects.c
index 0c2989d5ca..f9d36dabf2 100644
--- a/list-objects.c
+++ b/list-objects.c
@@ -51,6 +51,7 @@ static void process_blob(struct rev_info *revs,
 	if (!(obj->flags & USER_GIVEN) && filter_fn)
 		r = filter_fn(LOFS_BLOB, obj,
 			      path->buf, &path->buf[pathlen],
+			      &the_index,
 			      filter_data);
 	if (r & LOFR_MARK_SEEN)
 		obj->flags |= SEEN;
@@ -136,6 +137,7 @@ static void process_tree(struct rev_info *revs,
 	if (!(obj->flags & USER_GIVEN) && filter_fn)
 		r = filter_fn(LOFS_BEGIN_TREE, obj,
 			      base->buf, &base->buf[baselen],
+			      &the_index,
 			      filter_data);
 	if (r & LOFR_MARK_SEEN)
 		obj->flags |= SEEN;
@@ -175,6 +177,7 @@ static void process_tree(struct rev_info *revs,
 	if (!(obj->flags & USER_GIVEN) && filter_fn) {
 		r = filter_fn(LOFS_END_TREE, obj,
 			      base->buf, &base->buf[baselen],
+			      &the_index,
 			      filter_data);
 		if (r & LOFR_MARK_SEEN)
 			obj->flags |= SEEN;
-- 
2.19.1.647.g708186aaf9