parse_pathspec: save original pathspec for reporting

We usually use pathspec_item's match field for pathspec error reporting. However "match" (or "raw") does not show the magic part, which will play more important role later on. Preserve exact user input for reporting. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Jul 14, 2013 at 15:35 UTC d2ce1331953e9f4306e00f5edf3a6ce6e3330e9e
3 files changed +4
dir.c
+1
@@ -1599,6 +1599,7 @@ int init_pathspec(struct pathspec *pathspec, const char **paths)
1599 const char *path = paths[i];
1600
1601 item->match = path;
1602 + item->original = path;
1603 item->len = strlen(path);
1604 item->flags = 0;
1605 if (limit_pathspec_to_literal()) {
pathspec.c
+2
@@ -203,6 +203,7 @@ static unsigned prefix_pathspec(struct pathspec_item *item,
203 else
204 match = prefix_path(prefix, prefixlen, copyfrom);
205 *raw = item->match = match;
206 + item->original = elt;
207 item->len = strlen(item->match);
208 if (limit_pathspec_to_literal())
209 item->nowildcard_len = item->len;
@@ -277,6 +278,7 @@ void parse_pathspec(struct pathspec *pathspec,
278 pathspec->items = item = xmalloc(sizeof(*item));
279 memset(item, 0, sizeof(*item));
280 item->match = prefix;
281 + item->original = prefix;
282 item->nowildcard_len = item->len = strlen(prefix);
283 raw[0] = prefix;
284 raw[1] = NULL;
pathspec.h
+1
@@ -16,6 +16,7 @@ struct pathspec {
16 int max_depth;
17 struct pathspec_item {
18 const char *match;
19 + const char *original;
20 unsigned magic;
21 int len;
22 int nowildcard_len;