git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: git@vger.kernel.org, Alex Riesen <raa.lkml@gmail.com>
Subject: Re: [PATCH] Turn off pathspec magic on "{checkout,reset,add} -p" on native Windows builds
Date: Mon, 2 Sep 2013 16:30:00 +0700	[thread overview]
Message-ID: <20130902092959.GA17306@lanh> (raw)
In-Reply-To: <5224334A.2090300@viscovery.net>

On Mon, Sep 02, 2013 at 08:42:18AM +0200, Johannes Sixt wrote:
> Am 9/1/2013 4:08, schrieb Nguyễn Thái Ngọc Duy:
> > git-add--interactive.perl rejects arguments with colons in 21e9757
> > (Hack git-add--interactive to make it work with ActiveState Perl -
> > 2007-08-01). Pathspec magic starts with a colon, so it won't work if
> > these pathspecs are passed to git-add--interactive.perl running with
> > ActiveState Perl. Make sure we only pass plain paths in this case.
> > 
> > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> > ---
> >  Johannes, can you check the test suite passes for you with this
> >  patch? I assume that Cygwin Perl behaves differently and does not hit
> >  this limit. So I keep the special case to GIT_WINDOWS_NATIVE only.
> >  I'll resend the patch with a few others on the same topic if it works
> >  for you.
> 
> It does not help. The error in git-add--interactive is avoided, but the
> failure in t2016-checkout-patch.sh is now:
> 
> expecting success:
>         set_state dir/foo work head &&
>         # the third n is to get out in case it mistakenly does not apply
>         (echo y; echo n; echo n) | (cd dir && git checkout -p foo) &&
>         verify_saved_state bar &&
>         verify_state dir/foo head head
> 
> No changes.
> not ok 13 - path limiting works: foo inside dir
> 
> and the same "No changes." happens in t7105-reset-patch.sh

Right. Because I got rid of ':(prefix)foo' form but I passed 'foo'
instead of 'dir/foo'. How about this on top?

-- 8< --
diff --git a/builtin/add.c b/builtin/add.c
index 3402239..a138360 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -257,9 +257,15 @@ int run_add_interactive(const char *revision, const char *patch_mode,
 	if (revision)
 		args[ac++] = revision;
 	args[ac++] = "--";
+#ifdef GIT_WINDOWS_NATIVE
+	GUARD_PATHSPEC(pathspec, PATHSPEC_FROMTOP);
+	for (i = 0; i < pathspec->nr; i++)
+		args[ac++] = pathspec->items[i].match;
+#else
 	for (i = 0; i < pathspec->nr; i++)
 		/* pass original pathspec, to be re-parsed */
 		args[ac++] = pathspec->items[i].original;
+#endif
 
 	status = run_command_v_opt(args, RUN_GIT_CMD);
 	free(args);
-- 8< --

  reply	other threads:[~2013-09-02  9:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29  6:54 nd/magic-pathspec exposes breakage in git-add--interactive on Windows Johannes Sixt
2013-08-29  9:47 ` Duy Nguyen
2013-08-29 13:01 ` Alex Riesen
2013-09-01  2:08 ` [PATCH] Turn off pathspec magic on "{checkout,reset,add} -p" on native Windows builds Nguyễn Thái Ngọc Duy
2013-09-02  6:42   ` Johannes Sixt
2013-09-02  9:30     ` Duy Nguyen [this message]
2013-09-02 10:41       ` Johannes Sixt
2013-09-02 11:56         ` Duy Nguyen
2013-09-04  7:24           ` [PATCH] add--interactive: fix external command invocation on Windows Johannes Sixt
2013-09-04 12:02             ` Duy Nguyen

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=20130902092959.GA17306@lanh \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    --cc=raa.lkml@gmail.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).