if (!entry && !prefix)
return;
+ if ((flags & PATHSPEC_PREFER_CWD) &&
+ (flags & PATHSPEC_PREFER_FULL))
+ die("BUG: PATHSPEC_PREFER_CWD and PATHSPEC_PREFER_FULL are incompatible");
+
/* No arguments with prefix -> prefix pathspec */
if (!entry) {
static const char *raw[2];
+ if (flags & PATHSPEC_PREFER_FULL)
+ return;
+
+ if (!(flags & PATHSPEC_PREFER_CWD))
+ die("BUG: PATHSPEC_PREFER_CWD requires arguments");
+
pathspec->items = item = xmalloc(sizeof(*item));
memset(item, 0, sizeof(*item));
item->match = prefix;
struct pathspec ps;
parse_pathspec(&ps,
PATHSPEC_ALL_MAGIC & ~PATHSPEC_FROMTOP,
- 0, prefix, pathspec);
+ PATHSPEC_PREFER_CWD,
+ prefix, pathspec);
return ps.raw;
}
} *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,