From d2ce1331953e9f4306e00f5edf3a6ce6e3330e9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sun, 14 Jul 2013 15:35:29 +0700 Subject: [PATCH] parse_pathspec: save original pathspec for reporting MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- dir.c | 1 + pathspec.c | 2 ++ pathspec.h | 1 + 3 files changed, 4 insertions(+) diff --git a/dir.c b/dir.c index 5f86e467c..308028e5b 100644 --- a/dir.c +++ b/dir.c @@ -1599,6 +1599,7 @@ int init_pathspec(struct pathspec *pathspec, const char **paths) const char *path = paths[i]; item->match = path; + item->original = path; item->len = strlen(path); item->flags = 0; if (limit_pathspec_to_literal()) { diff --git a/pathspec.c b/pathspec.c index ce942dbcc..f94beb607 100644 --- a/pathspec.c +++ b/pathspec.c @@ -203,6 +203,7 @@ static unsigned prefix_pathspec(struct pathspec_item *item, else match = prefix_path(prefix, prefixlen, copyfrom); *raw = item->match = match; + item->original = elt; item->len = strlen(item->match); if (limit_pathspec_to_literal()) item->nowildcard_len = item->len; @@ -277,6 +278,7 @@ void parse_pathspec(struct pathspec *pathspec, pathspec->items = item = xmalloc(sizeof(*item)); memset(item, 0, sizeof(*item)); item->match = prefix; + item->original = prefix; item->nowildcard_len = item->len = strlen(prefix); raw[0] = prefix; raw[1] = NULL; diff --git a/pathspec.h b/pathspec.h index 937ec91a0..cc5841b77 100644 --- a/pathspec.h +++ b/pathspec.h @@ -16,6 +16,7 @@ struct pathspec { int max_depth; struct pathspec_item { const char *match; + const char *original; unsigned magic; int len; int nowildcard_len; -- 2.11.0