dir: convert prep_exclude 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 e799ed408eb59ca631c4908ba4236cd146ff6bd2
1 file changed +8 -6
dir.c
+8 -6
@@ -1046,7 +1046,9 @@ static struct exclude *last_exclude_matching_from_lists(struct dir_struct *dir,
1046 * Loads the per-directory exclude list for the substring of base
1047 * which has a char length of baselen.
1048 */
1049 -static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
1049 +static void prep_exclude(struct dir_struct *dir,
1050 + struct index_state *istate,
1051 + const char *base, int baselen)
1052 {
1053 struct exclude_list_group *group;
1054 struct exclude_list *el;
@@ -1125,7 +1127,7 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
1127 int dt = DT_DIR;
1128 dir->basebuf.buf[stk->baselen - 1] = 0;
1129 dir->exclude = last_exclude_matching_from_lists(dir,
1128 - &the_index,
1130 + istate,
1131 dir->basebuf.buf, stk->baselen - 1,
1132 dir->basebuf.buf + current, &dt);
1133 dir->basebuf.buf[stk->baselen - 1] = '/';
@@ -1167,7 +1169,7 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
1169 strbuf_addbuf(&sb, &dir->basebuf);
1170 strbuf_addstr(&sb, dir->exclude_per_dir);
1171 el->src = strbuf_detach(&sb, NULL);
1170 - add_excludes(el->src, el->src, stk->baselen, el, &the_index,
1172 + add_excludes(el->src, el->src, stk->baselen, el, istate,
1173 untracked ? &sha1_stat : NULL);
1174 }
1175 /*
@@ -1209,7 +1211,7 @@ struct exclude *last_exclude_matching(struct dir_struct *dir,
1211 const char *basename = strrchr(pathname, '/');
1212 basename = (basename) ? basename+1 : pathname;
1213
1212 - prep_exclude(dir, pathname, basename-pathname);
1214 + prep_exclude(dir, &the_index, pathname, basename-pathname);
1215
1216 if (dir->exclude)
1217 return dir->exclude;
@@ -1695,10 +1697,10 @@ static int valid_cached_dir(struct dir_struct *dir,
1697 */
1698 if (path->len && path->buf[path->len - 1] != '/') {
1699 strbuf_addch(path, '/');
1698 - prep_exclude(dir, path->buf, path->len);
1700 + prep_exclude(dir, &the_index, path->buf, path->len);
1701 strbuf_setlen(path, path->len - 1);
1702 } else
1701 - prep_exclude(dir, path->buf, path->len);
1703 + prep_exclude(dir, &the_index, path->buf, path->len);
1704
1705 /* hopefully prep_exclude() haven't invalidated this entry... */
1706 return untracked->valid;