setup.c: check that the pathspec magic ends with ")"
authorAndrew Wong <andrew.kw.w@gmail.com>
Sat, 9 Mar 2013 23:46:00 +0000 (18:46 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Mar 2013 16:39:36 +0000 (09:39 -0700)
The previous code did not diagnose an incorrectly spelled ":(top"
as an error.

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
setup.c
diff --git a/setup.c b/setup.c
index e61458a7d05497dc83d7b64448980f483a593211..da0d8c80ba47ba9b9085c9fbb8e961712354f332 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -216,8 +216,9 @@ static const char *prefix_pathspec(const char *prefix, int prefixlen, const char
                                die("Invalid pathspec magic '%.*s' in '%s'",
                                    (int) len, copyfrom, elt);
                }
-               if (*copyfrom == ')')
-                       copyfrom++;
+               if (*copyfrom != ')')
+                       die("Missing ')' at the end of pathspec magic in '%s'", elt);
+               copyfrom++;
        } else {
                /* shorthand */
                for (copyfrom = elt + 1;