From b0db70465246bb8309d3d12c9bc34ac3f0c1e203 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Mon, 13 Mar 2017 11:23:21 -0700 Subject: pathspec: allow querying for attributes The pathspec mechanism is extended via the new ":(attr:eol=input)pattern/to/match" syntax to filter paths so that it requires paths to not just match the given pattern but also have the specified attrs attached for them to be chosen. Based on a patch by Stefan Beller Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- pathspec.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'pathspec.h') diff --git a/pathspec.h b/pathspec.h index 49fd823dd..55e976972 100644 --- a/pathspec.h +++ b/pathspec.h @@ -8,13 +8,15 @@ #define PATHSPEC_GLOB (1<<3) #define PATHSPEC_ICASE (1<<4) #define PATHSPEC_EXCLUDE (1<<5) +#define PATHSPEC_ATTR (1<<6) #define PATHSPEC_ALL_MAGIC \ (PATHSPEC_FROMTOP | \ PATHSPEC_MAXDEPTH | \ PATHSPEC_LITERAL | \ PATHSPEC_GLOB | \ PATHSPEC_ICASE | \ - PATHSPEC_EXCLUDE) + PATHSPEC_EXCLUDE | \ + PATHSPEC_ATTR) #define PATHSPEC_ONESTAR 1 /* the pathspec pattern satisfies GFNM_ONESTAR */ @@ -31,6 +33,17 @@ struct pathspec { int len, prefix; int nowildcard_len; int flags; + int attr_match_nr; + struct attr_match { + char *value; + enum attr_match_mode { + MATCH_SET, + MATCH_UNSET, + MATCH_VALUE, + MATCH_UNSPECIFIED + } match_mode; + } *attr_match; + struct attr_check *attr_check; } *items; }; -- cgit v1.2.1