dir: convert last_exclude_matching_from_list to take an index
Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams committed
May 5, 2017 at 12:53 UTC
2b70e88d367f3e697023c2b7c3054e8a26e6faaa
1 file changed
+8
-5
dir.c
+8
-5
@@ -961,7 +961,8 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
961
int pathlen,
962
const char *basename,
963
int *dtype,
964
- struct exclude_list *el)
964
+ struct exclude_list *el,
965
+ struct index_state *istate)
966
{
967
struct exclude *exc = NULL; /* undecided */
968
int i;
@@ -976,7 +977,7 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
977
978
if (x->flags & EXC_FLAG_MUSTBEDIR) {
979
if (*dtype == DT_UNKNOWN)
979
- *dtype = get_dtype(NULL, &the_index, pathname, pathlen);
980
+ *dtype = get_dtype(NULL, istate, pathname, pathlen);
981
if (*dtype != DT_DIR)
982
continue;
983
}
@@ -1012,13 +1013,14 @@ int is_excluded_from_list(const char *pathname,
1013
struct exclude_list *el)
1014
{
1015
struct exclude *exclude;
1015
- exclude = last_exclude_matching_from_list(pathname, pathlen, basename, dtype, el);
1016
+ exclude = last_exclude_matching_from_list(pathname, pathlen, basename, dtype, el, &the_index);
1017
if (exclude)
1018
return exclude->flags & EXC_FLAG_NEGATIVE ? 0 : 1;
1019
return -1; /* undecided */
1020
}
1021
1022
static struct exclude *last_exclude_matching_from_lists(struct dir_struct *dir,
1023
+ struct index_state *istate,
1024
const char *pathname, int pathlen, const char *basename,
1025
int *dtype_p)
1026
{
@@ -1030,7 +1032,7 @@ static struct exclude *last_exclude_matching_from_lists(struct dir_struct *dir,
1032
for (j = group->nr - 1; j >= 0; j--) {
1033
exclude = last_exclude_matching_from_list(
1034
pathname, pathlen, basename, dtype_p,
1033
- &group->el[j]);
1035
+ &group->el[j], istate);
1036
if (exclude)
1037
return exclude;
1038
}
@@ -1121,6 +1123,7 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
1123
int dt = DT_DIR;
1124
dir->basebuf.buf[stk->baselen - 1] = 0;
1125
dir->exclude = last_exclude_matching_from_lists(dir,
1126
+ &the_index,
1127
dir->basebuf.buf, stk->baselen - 1,
1128
dir->basebuf.buf + current, &dt);
1129
dir->basebuf.buf[stk->baselen - 1] = '/';
@@ -1209,7 +1212,7 @@ struct exclude *last_exclude_matching(struct dir_struct *dir,
1212
if (dir->exclude)
1213
return dir->exclude;
1214
1212
- return last_exclude_matching_from_lists(dir, pathname, pathlen,
1215
+ return last_exclude_matching_from_lists(dir, &the_index, pathname, pathlen,
1216
basename, dtype_p);
1217
}
1218