Skip to content

Commit

Permalink
add: lift the pathspec magic restriction on "add -p"
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Sep 5, 2013
1 parent bc341c8 commit 625c330
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
8 changes: 1 addition & 7 deletions builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,7 @@ int interactive_add(int argc, const char **argv, const char *prefix, int patch)
{
struct pathspec pathspec;

/*
* git-add--interactive itself does not parse pathspec. It
* simply passes the pathspec to other builtin commands. Let's
* hope all of them support all magic, or we'll need to limit
* the magic here.
*/
parse_pathspec(&pathspec, PATHSPEC_ALL_MAGIC & ~PATHSPEC_FROMTOP,
parse_pathspec(&pathspec, 0,
PATHSPEC_PREFER_FULL |
PATHSPEC_SYMLINK_LEADING_PATH |
PATHSPEC_PREFIX_ORIGIN,
Expand Down
7 changes: 0 additions & 7 deletions builtin/checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,13 +1149,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
}

if (argc) {
/*
* In patch mode (opts.patch_mode != 0), we pass the
* pathspec to an external program, git-add--interactive.
* Do not accept any kind of magic that that program
* cannot handle. Magic mask is pretty safe to be
* lifted for new magic when opts.patch_mode == 0.
*/
parse_pathspec(&opts.pathspec, 0,
opts.patch_mode ? PATHSPEC_PREFIX_ORIGIN : 0,
prefix, argv);
Expand Down

0 comments on commit 625c330

Please sign in to comment.