guard against new pathspec magic in pathspec matching code
[gitweb.git] / pathspec.h
index 2e427d7f4c36bce6285d677cb29d911b110c2d14..6baf2058622d0a9d26e5a20547525a60ebd30ccb 100644 (file)
@@ -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 */