diff options
Diffstat (limited to 'pathspec.h')
-rw-r--r-- | pathspec.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/pathspec.h b/pathspec.h index 454ce364fa..2341dc9901 100644 --- a/pathspec.h +++ b/pathspec.h @@ -108,7 +108,7 @@ struct pathspec { * * A similar process is applied when a new pathspec magic is added. The designer * lifts the GUARD_PATHSPEC restriction in the functions that support the new - * magic. At the same time (s)he has to make sure this new feature will be + * magic while at the same time making sure this new feature will be * caught at parse_pathspec() in commands that cannot handle the new magic in * some cases. grepping parse_pathspec() should help. */ @@ -149,12 +149,26 @@ static inline int ps_strcmp(const struct pathspec_item *item, return strcmp(s1, s2); } +enum ps_skip_worktree_action { + PS_HEED_SKIP_WORKTREE = 0, + PS_IGNORE_SKIP_WORKTREE = 1 +}; void add_pathspec_matches_against_index(const struct pathspec *pathspec, - const struct index_state *istate, - char *seen); + struct index_state *istate, + char *seen, + enum ps_skip_worktree_action sw_action); char *find_pathspecs_matching_against_index(const struct pathspec *pathspec, - const struct index_state *istate); -int match_pathspec_attrs(const struct index_state *istate, + struct index_state *istate, + enum ps_skip_worktree_action sw_action); +char *find_pathspecs_matching_skip_worktree(const struct pathspec *pathspec); +static inline int matches_skip_worktree(const struct pathspec *pathspec, + int item, char **seen_ptr) +{ + if (!*seen_ptr) + *seen_ptr = find_pathspecs_matching_skip_worktree(pathspec); + return (*seen_ptr)[item]; +} +int match_pathspec_attrs(struct index_state *istate, const char *name, int namelen, const struct pathspec_item *item); |