dir.c: factor out parts of last_exclude_matching for later reuse
Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
5bd8e2d894
commit
46aa2f95d2
36
dir.c
36
dir.c
@ -795,25 +795,13 @@ int is_excluded_from_list(const char *pathname,
|
|||||||
return -1; /* undecided */
|
return -1; /* undecided */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static struct exclude *last_exclude_matching_from_lists(struct dir_struct *dir,
|
||||||
* Loads the exclude lists for the directory containing pathname, then
|
const char *pathname, int pathlen, const char *basename,
|
||||||
* scans all exclude lists to determine whether pathname is excluded.
|
|
||||||
* Returns the exclude_list element which matched, or NULL for
|
|
||||||
* undecided.
|
|
||||||
*/
|
|
||||||
static struct exclude *last_exclude_matching(struct dir_struct *dir,
|
|
||||||
const char *pathname,
|
|
||||||
int *dtype_p)
|
int *dtype_p)
|
||||||
{
|
{
|
||||||
int pathlen = strlen(pathname);
|
|
||||||
int i, j;
|
int i, j;
|
||||||
struct exclude_list_group *group;
|
struct exclude_list_group *group;
|
||||||
struct exclude *exclude;
|
struct exclude *exclude;
|
||||||
const char *basename = strrchr(pathname, '/');
|
|
||||||
basename = (basename) ? basename+1 : pathname;
|
|
||||||
|
|
||||||
prep_exclude(dir, pathname, basename-pathname);
|
|
||||||
|
|
||||||
for (i = EXC_CMDL; i <= EXC_FILE; i++) {
|
for (i = EXC_CMDL; i <= EXC_FILE; i++) {
|
||||||
group = &dir->exclude_list_group[i];
|
group = &dir->exclude_list_group[i];
|
||||||
for (j = group->nr - 1; j >= 0; j--) {
|
for (j = group->nr - 1; j >= 0; j--) {
|
||||||
@ -827,6 +815,26 @@ static struct exclude *last_exclude_matching(struct dir_struct *dir,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Loads the exclude lists for the directory containing pathname, then
|
||||||
|
* scans all exclude lists to determine whether pathname is excluded.
|
||||||
|
* Returns the exclude_list element which matched, or NULL for
|
||||||
|
* undecided.
|
||||||
|
*/
|
||||||
|
static struct exclude *last_exclude_matching(struct dir_struct *dir,
|
||||||
|
const char *pathname,
|
||||||
|
int *dtype_p)
|
||||||
|
{
|
||||||
|
int pathlen = strlen(pathname);
|
||||||
|
const char *basename = strrchr(pathname, '/');
|
||||||
|
basename = (basename) ? basename+1 : pathname;
|
||||||
|
|
||||||
|
prep_exclude(dir, pathname, basename-pathname);
|
||||||
|
|
||||||
|
return last_exclude_matching_from_lists(dir, pathname, pathlen,
|
||||||
|
basename, dtype_p);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loads the exclude lists for the directory containing pathname, then
|
* Loads the exclude lists for the directory containing pathname, then
|
||||||
* scans all exclude lists to determine whether pathname is excluded.
|
* scans all exclude lists to determine whether pathname is excluded.
|
||||||
|
Loading…
Reference in New Issue
Block a user