git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 2/3] add: lift the pathspec magic restriction on "add -p"
Date: Thu,  5 Sep 2013 10:40:39 +0700	[thread overview]
Message-ID: <1378352440-25410-2-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1378352440-25410-1-git-send-email-pclouds@gmail.com>

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>
---
 builtin/add.c      | 8 +-------
 builtin/checkout.c | 7 -------
 2 files changed, 1 insertion(+), 14 deletions(-)

diff --git a/builtin/add.c b/builtin/add.c
index 9d52fc7..b4035f6 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -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,
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 7ea1100..b235e04 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -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);
-- 
1.8.2.83.gc99314b

  reply	other threads:[~2013-09-05  3:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05  3:40 [PATCH 1/3] pathspec: catch prepending :(prefix) on pathspec with short magic Nguyễn Thái Ngọc Duy
2013-09-05  3:40 ` Nguyễn Thái Ngọc Duy [this message]
2013-09-05  3:40 ` [PATCH 3/3] add--interactive: fix external command invocation on Windows Nguyễn Thái Ngọc Duy
2013-09-05 18:39 ` [PATCH 1/3] pathspec: catch prepending :(prefix) on pathspec with short magic Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1378352440-25410-2-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).