add: lift the pathspec magic restriction on "add -p"

Since 480ca64 (convert run_add_interactive to use struct pathspec - 2013-07-14), we have unconditionally passed :(prefix)xxx to add-interactive.perl. It implies that all commands add-interactive.perl calls must be aware of pathspec magic, or :(prefix) is barfed. The restriction to :/ only becomes unnecessary. 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 Sep 5, 2013 at 10:40 UTC 625c3304e200f9bdc05626be1397311faa4962ba
2 files changed +1 -14
builtin/add.c
+1 -7
@@ -270,13 +270,7 @@ int interactive_add(int argc, const char **argv, const char *prefix, int patch)
270 {
271 struct pathspec pathspec;
272
273 - /*
274 - * git-add--interactive itself does not parse pathspec. It
275 - * simply passes the pathspec to other builtin commands. Let's
276 - * hope all of them support all magic, or we'll need to limit
277 - * the magic here.
278 - */
279 - parse_pathspec(&pathspec, PATHSPEC_ALL_MAGIC & ~PATHSPEC_FROMTOP,
273 + parse_pathspec(&pathspec, 0,
274 PATHSPEC_PREFER_FULL |
275 PATHSPEC_SYMLINK_LEADING_PATH |
276 PATHSPEC_PREFIX_ORIGIN,
builtin/checkout.c
-7
@@ -1149,13 +1149,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
1149 }
1150
1151 if (argc) {
1152 - /*
1153 - * In patch mode (opts.patch_mode != 0), we pass the
1154 - * pathspec to an external program, git-add--interactive.
1155 - * Do not accept any kind of magic that that program
1156 - * cannot handle. Magic mask is pretty safe to be
1157 - * lifted for new magic when opts.patch_mode == 0.
1158 - */
1152 parse_pathspec(&opts.pathspec, 0,
1153 opts.patch_mode ? PATHSPEC_PREFIX_ORIGIN : 0,
1154 prefix, argv);