summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorKarsten Blees <karsten.blees@gmail.com>2013-04-15 19:11:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-15 19:34:00 (GMT)
commit46aa2f95d2fa79164fb0f5ad79bdd1d26fe689ea (patch)
tree000d00071b43dd78a4b74602ea84eb8c0d50362f /dir.c
parent5bd8e2d894be3a27e9b32b062ff224cc2396b69c (diff)
downloadgit-46aa2f95d2fa79164fb0f5ad79bdd1d26fe689ea.zip
git-46aa2f95d2fa79164fb0f5ad79bdd1d26fe689ea.tar.gz
git-46aa2f95d2fa79164fb0f5ad79bdd1d26fe689ea.tar.bz2
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>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/dir.c b/dir.c
index 7a98e3a..46d127c 100644
--- a/dir.c
+++ b/dir.c
@@ -795,6 +795,26 @@ int is_excluded_from_list(const char *pathname,
return -1; /* undecided */
}
+static struct exclude *last_exclude_matching_from_lists(struct dir_struct *dir,
+ const char *pathname, int pathlen, const char *basename,
+ int *dtype_p)
+{
+ int i, j;
+ struct exclude_list_group *group;
+ struct exclude *exclude;
+ for (i = EXC_CMDL; i <= EXC_FILE; i++) {
+ group = &dir->exclude_list_group[i];
+ for (j = group->nr - 1; j >= 0; j--) {
+ exclude = last_exclude_matching_from_list(
+ pathname, pathlen, basename, dtype_p,
+ &group->el[j]);
+ if (exclude)
+ return exclude;
+ }
+ }
+ return NULL;
+}
+
/*
* Loads the exclude lists for the directory containing pathname, then
* scans all exclude lists to determine whether pathname is excluded.
@@ -806,25 +826,13 @@ static struct exclude *last_exclude_matching(struct dir_struct *dir,
int *dtype_p)
{
int pathlen = strlen(pathname);
- int i, j;
- struct exclude_list_group *group;
- 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++) {
- group = &dir->exclude_list_group[i];
- for (j = group->nr - 1; j >= 0; j--) {
- exclude = last_exclude_matching_from_list(
- pathname, pathlen, basename, dtype_p,
- &group->el[j]);
- if (exclude)
- return exclude;
- }
- }
- return NULL;
+ return last_exclude_matching_from_lists(dir, pathname, pathlen,
+ basename, dtype_p);
}
/*