summaryrefslogtreecommitdiff
path: root/builtin/add.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-09-18 17:31:59 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-09-21 16:17:02 (GMT)
commit84d938b732242e81ec68647994070eb7c34d061f (patch)
tree2179095e9c8dcf8872129f962dd4a15204005693 /builtin/add.c
parentd33c87517a85f544159b2efa406136dde18a5b9f (diff)
downloadgit-84d938b732242e81ec68647994070eb7c34d061f.zip
git-84d938b732242e81ec68647994070eb7c34d061f.tar.gz
git-84d938b732242e81ec68647994070eb7c34d061f.tar.bz2
add: do not accept pathspec magic 'attr'
Commit b0db704652 (pathspec: allow querying for attributes - 2017-03-13) adds new pathspec magic 'attr' but only with match_pathspec(). "git add" has some pathspec related code that still does not know about 'attr' and will bail out: $ git add ':(attr:foo)' fatal: BUG:dir.c:1584: unsupported magic 40 A better solution would be making this code support 'attr'. But I don't know how much work is needed (I'm not familiar with this new magic). For now, let's simply reject this magic with a friendlier message: $ git add ':(attr:foo)' fatal: :(attr:foo): pathspec magic not supported by this command: 'attr' Update t6135 so that the expected error message is from the "graceful" rejection codepath, not "oops, we were supposed to reject the request to trigger this magic" codepath. Reported-by: smaudet@sebastianaudet.com Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/add.c b/builtin/add.c
index a648cf4..cb1d961 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -433,7 +433,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
* Check the "pathspec '%s' did not match any files" block
* below before enabling new magic.
*/
- parse_pathspec(&pathspec, 0,
+ parse_pathspec(&pathspec, PATHSPEC_ATTR,
PATHSPEC_PREFER_FULL |
PATHSPEC_SYMLINK_LEADING_PATH,
prefix, argv);