зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
9e58becab9
Коммит
2b70e88d36
13
dir.c
13
dir.c
|
@ -961,7 +961,8 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
|
||||||
int pathlen,
|
int pathlen,
|
||||||
const char *basename,
|
const char *basename,
|
||||||
int *dtype,
|
int *dtype,
|
||||||
struct exclude_list *el)
|
struct exclude_list *el,
|
||||||
|
struct index_state *istate)
|
||||||
{
|
{
|
||||||
struct exclude *exc = NULL; /* undecided */
|
struct exclude *exc = NULL; /* undecided */
|
||||||
int i;
|
int i;
|
||||||
|
@ -976,7 +977,7 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
|
||||||
|
|
||||||
if (x->flags & EXC_FLAG_MUSTBEDIR) {
|
if (x->flags & EXC_FLAG_MUSTBEDIR) {
|
||||||
if (*dtype == DT_UNKNOWN)
|
if (*dtype == DT_UNKNOWN)
|
||||||
*dtype = get_dtype(NULL, &the_index, pathname, pathlen);
|
*dtype = get_dtype(NULL, istate, pathname, pathlen);
|
||||||
if (*dtype != DT_DIR)
|
if (*dtype != DT_DIR)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1012,13 +1013,14 @@ int is_excluded_from_list(const char *pathname,
|
||||||
struct exclude_list *el)
|
struct exclude_list *el)
|
||||||
{
|
{
|
||||||
struct exclude *exclude;
|
struct exclude *exclude;
|
||||||
exclude = last_exclude_matching_from_list(pathname, pathlen, basename, dtype, el);
|
exclude = last_exclude_matching_from_list(pathname, pathlen, basename, dtype, el, &the_index);
|
||||||
if (exclude)
|
if (exclude)
|
||||||
return exclude->flags & EXC_FLAG_NEGATIVE ? 0 : 1;
|
return exclude->flags & EXC_FLAG_NEGATIVE ? 0 : 1;
|
||||||
return -1; /* undecided */
|
return -1; /* undecided */
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct exclude *last_exclude_matching_from_lists(struct dir_struct *dir,
|
static struct exclude *last_exclude_matching_from_lists(struct dir_struct *dir,
|
||||||
|
struct index_state *istate,
|
||||||
const char *pathname, int pathlen, const char *basename,
|
const char *pathname, int pathlen, const char *basename,
|
||||||
int *dtype_p)
|
int *dtype_p)
|
||||||
{
|
{
|
||||||
|
@ -1030,7 +1032,7 @@ static struct exclude *last_exclude_matching_from_lists(struct dir_struct *dir,
|
||||||
for (j = group->nr - 1; j >= 0; j--) {
|
for (j = group->nr - 1; j >= 0; j--) {
|
||||||
exclude = last_exclude_matching_from_list(
|
exclude = last_exclude_matching_from_list(
|
||||||
pathname, pathlen, basename, dtype_p,
|
pathname, pathlen, basename, dtype_p,
|
||||||
&group->el[j]);
|
&group->el[j], istate);
|
||||||
if (exclude)
|
if (exclude)
|
||||||
return exclude;
|
return exclude;
|
||||||
}
|
}
|
||||||
|
@ -1121,6 +1123,7 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
|
||||||
int dt = DT_DIR;
|
int dt = DT_DIR;
|
||||||
dir->basebuf.buf[stk->baselen - 1] = 0;
|
dir->basebuf.buf[stk->baselen - 1] = 0;
|
||||||
dir->exclude = last_exclude_matching_from_lists(dir,
|
dir->exclude = last_exclude_matching_from_lists(dir,
|
||||||
|
&the_index,
|
||||||
dir->basebuf.buf, stk->baselen - 1,
|
dir->basebuf.buf, stk->baselen - 1,
|
||||||
dir->basebuf.buf + current, &dt);
|
dir->basebuf.buf + current, &dt);
|
||||||
dir->basebuf.buf[stk->baselen - 1] = '/';
|
dir->basebuf.buf[stk->baselen - 1] = '/';
|
||||||
|
@ -1209,7 +1212,7 @@ struct exclude *last_exclude_matching(struct dir_struct *dir,
|
||||||
if (dir->exclude)
|
if (dir->exclude)
|
||||||
return dir->exclude;
|
return dir->exclude;
|
||||||
|
|
||||||
return last_exclude_matching_from_lists(dir, pathname, pathlen,
|
return last_exclude_matching_from_lists(dir, &the_index, pathname, pathlen,
|
||||||
basename, dtype_p);
|
basename, dtype_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче