guard against new pathspec magic in pathspec matching code
GUARD_PATHSPEC() marks pathspec-sensitive code, basically all those that touch anything in 'struct pathspec' except fields "nr" and "original". GUARD_PATHSPEC() is not supposed to fail. It's mainly to help the designers catch unsupported codepaths. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
dad2586a6b
commit
8f4f8f4579
@ -27,6 +27,13 @@ struct pathspec {
|
||||
} *items;
|
||||
};
|
||||
|
||||
#define GUARD_PATHSPEC(ps, mask) \
|
||||
do { \
|
||||
if ((ps)->magic & ~(mask)) \
|
||||
die("BUG:%s:%d: unsupported magic %x", \
|
||||
__FILE__, __LINE__, (ps)->magic & ~(mask)); \
|
||||
} while (0)
|
||||
|
||||
/* 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 */
|
||||
|
Reference in New Issue
Block a user