Skip to content

Commit 625c330

Browse files
pcloudsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bc341c8 commit 625c330

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

builtin/add.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,7 @@ int interactive_add(int argc, const char **argv, const char *prefix, int patch)
270270
{
271271
struct pathspec pathspec;
272272

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,
280274
PATHSPEC_PREFER_FULL |
281275
PATHSPEC_SYMLINK_LEADING_PATH |
282276
PATHSPEC_PREFIX_ORIGIN,

builtin/checkout.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,13 +1149,6 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
11491149
}
11501150

11511151
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-
*/
11591152
parse_pathspec(&opts.pathspec, 0,
11601153
opts.patch_mode ? PATHSPEC_PREFIX_ORIGIN : 0,
11611154
prefix, argv);

0 commit comments

Comments
 (0)