From e813d50e35653bdb0ce3329f99d1be7fc1c36de5 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 25 Dec 2006 03:09:52 -0800 Subject: match_pathspec() -- return how well the spec matched This updates the return value from match_pathspec() so that the caller can tell cases between exact match, leading pathname match (i.e. file "foo/bar" matches a pathspec "foo"), or filename glob match. This can be used to prevent "rm dir" from removing "dir/file" without explicitly asking for recursive behaviour with -r flag, for example. Signed-off-by: Junio C Hamano --- dir.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'dir.h') diff --git a/dir.h b/dir.h index 550551ab25..c919727949 100644 --- a/dir.h +++ b/dir.h @@ -40,6 +40,10 @@ struct dir_struct { }; extern int common_prefix(const char **pathspec); + +#define MATCHED_RECURSIVELY 1 +#define MATCHED_FNMATCH 2 +#define MATCHED_EXACTLY 3 extern int match_pathspec(const char **pathspec, const char *name, int namelen, int prefix, char *seen); extern int read_directory(struct dir_struct *, const char *path, const char *base, int baselen); -- cgit v1.2.3