From fc12261fea778cabd08dec707169cb88ecdbc647 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Sun, 14 Jul 2013 15:35:30 +0700 Subject: parse_pathspec: add PATHSPEC_PREFER_{CWD,FULL} flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have two ways of dealing with empty pathspec: 1. limit it to current prefix 2. match the entire working directory Some commands go with #1, some #2. get_pathspec() and parse_pathspec() only support #1. Make parse_pathspec() reject empty pathspec by default. #1 and #2 can be specified via new flags. This makes it more expressive about default behavior at command level. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- pathspec.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pathspec.h') diff --git a/pathspec.h b/pathspec.h index cc5841b77f..d630e8b1f9 100644 --- a/pathspec.h +++ b/pathspec.h @@ -24,6 +24,10 @@ struct pathspec { } *items; }; +/* parse_pathspec flags */ +#define PATHSPEC_PREFER_CWD (1<<0) /* No args means match cwd */ +#define PATHSPEC_PREFER_FULL (1<<1) /* No args means match everything */ + extern int init_pathspec(struct pathspec *, const char **); extern void parse_pathspec(struct pathspec *pathspec, unsigned magic_mask, -- cgit v1.3