convert run_add_interactive to use struct pathspec

This passes the pathspec, more or less unmodified, to
git-add--interactive. The command itself does not process pathspec. It
simply passes the pathspec to other builtin commands. So if all those
commands support pathspec, we're good.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2013-07-14 15:35:50 +07:00
committed by Junio C Hamano
parent 5ab2a2dabd
commit 480ca6449e
4 changed files with 19 additions and 26 deletions

View File

@ -257,7 +257,7 @@ static int checkout_paths(const struct checkout_opts *opts,
if (opts->patch_mode)
return run_add_interactive(revision, "--patch=checkout",
opts->pathspec.raw);
&opts->pathspec);
lock_file = xcalloc(1, sizeof(struct lock_file));
@ -1159,10 +1159,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
* cannot handle. Magic mask is pretty safe to be
* lifted for new magic when opts.patch_mode == 0.
*/
parse_pathspec(&opts.pathspec,
opts.patch_mode == 0 ? 0 :
(PATHSPEC_ALL_MAGIC & ~PATHSPEC_FROMTOP),
0, prefix, argv);
parse_pathspec(&opts.pathspec, 0,
opts.patch_mode ? PATHSPEC_PREFIX_ORIGIN : 0,
prefix, argv);
if (!opts.pathspec.nr)
die(_("invalid path specification"));