From ab8db61390afd803ddd9778f84ba4c28dfa975c6 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Tue, 3 Sep 2019 11:04:55 -0700 Subject: treewide: rename 'struct exclude' to 'struct path_pattern' The first consumer of pattern-matching filenames was the .gitignore feature. In that context, storing a list of patterns as a list of 'struct exclude' items makes sense. However, the sparse-checkout feature then adopted these structures and methods, but with the opposite meaning: these patterns match the files that should be included! It would be clearer to rename this entire library as a "pattern matching" library, and the callers apply exclusion/inclusion logic accordingly based on their needs. This commit renames 'struct exclude' to 'struct path_pattern' and renames several variable names to match. 'struct pattern' was already taken by attr.c, and this more completely describes that the patterns are specific to file paths. Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- dir.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'dir.h') diff --git a/dir.h b/dir.h index 680079bbe3..e8b90fc482 100644 --- a/dir.h +++ b/dir.h @@ -16,7 +16,7 @@ struct dir_entry { #define EXC_FLAG_MUSTBEDIR 8 #define EXC_FLAG_NEGATIVE 16 -struct exclude { +struct path_pattern { /* * This allows callers of last_exclude_matching() etc. * to determine the origin of the matching pattern. @@ -54,7 +54,7 @@ struct exclude_list { /* origin of list, e.g. path to filename, or descriptive string */ const char *src; - struct exclude **excludes; + struct path_pattern **patterns; }; /* @@ -191,7 +191,7 @@ struct dir_struct { * matching exclude struct if the directory is excluded. */ struct exclude_stack *exclude_stack; - struct exclude *exclude; + struct path_pattern *pattern; struct strbuf basebuf; /* Enable untracked file cache if set */ @@ -248,7 +248,7 @@ int match_pathname(const char *, int, const char *, int, const char *, int, int, unsigned); -struct exclude *last_exclude_matching(struct dir_struct *dir, +struct path_pattern *last_exclude_matching(struct dir_struct *dir, struct index_state *istate, const char *name, int *dtype); -- cgit v1.2.3