1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-31 06:17:56 +01:00
git/wildmatch.h
Nguyễn Thái Ngọc Duy 40bbee0ab0 wildmatch: adjust "**" behavior
Standard wildmatch() sees consecutive asterisks as "*" that can also
match slashes. But that may be hard to explain to users as
"abc/**/def" can match "abcdef", "abcxyzdef", "abc/def", "abc/x/def",
"abc/x/y/def"...

This patch changes wildmatch so that users can do

- "**/def" -> all paths ending with file/directory 'def'
- "abc/**" - equivalent to "/abc/"
- "abc/**/def" -> "abc/x/def", "abc/x/y/def"...
- otherwise consider the pattern malformed if "**" is found

Basically the magic of "**" only remains if it's wrapped around by
slashes.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-15 14:58:18 -07:00

9 lines
195 B
C

/* wildmatch.h */
#define ABORT_MALFORMED 2
#define NOMATCH 1
#define MATCH 0
#define ABORT_ALL -1
#define ABORT_TO_STARSTAR -2
int wildmatch(const char *pattern, const char *text, int flags);