summaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/setup.c b/setup.c
index 820ed05b27..5048252d78 100644
--- a/setup.c
+++ b/setup.c
@@ -197,19 +197,26 @@ const char *prefix_pathspec(const char *prefix, int prefixlen, const char *elt)
}
if (*copyfrom == ')')
copyfrom++;
+ } else if (!elt[1]) {
+ /* Just ':' -- no element! */
+ return NULL;
} else {
/* shorthand */
for (copyfrom = elt + 1;
*copyfrom && *copyfrom != ':';
copyfrom++) {
char ch = *copyfrom;
+
+ if (!is_pathspec_magic(ch))
+ break;
for (i = 0; i < ARRAY_SIZE(pathspec_magic); i++)
if (pathspec_magic[i].mnemonic == ch) {
magic |= pathspec_magic[i].bit;
break;
}
if (ARRAY_SIZE(pathspec_magic) <= i)
- break;
+ die("Unimplemented pathspec magic '%c' in '%s'",
+ ch, elt);
}
if (*copyfrom == ':')
copyfrom++;