git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Turn off pathspec magic on "{checkout,reset,add} -p" on native Windows builds

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Sep 2, 2013, 06:42 UTC
Message-ID
<5224334A.2090300@viscovery.net>
In-Reply-To
<1378001284-18426-1-git-send-email-pclouds@gmail.com>
Am 9/1/2013 4:08, schrieb Nguyễn Thái Ngọc Duy:
Show 13 quoted lines
> 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
Show 21 quoted lines
> +#ifdef GIT_WINDOWS_NATIVE
> +	/*
> +	 * Pathspec magic is completely turned off on native Windows
> +	 * builds because git-add-interactive.perl won't accept
> +	 * arguments with colons in them. :/foo is an exception
> +	 * because no colons remain after parsing.
> +	 */
> +	parse_pathspec(&pathspec, PATHSPEC_ALL_MAGIC & ~PATHSPEC_FROMTOP,
> +		       PATHSPEC_PREFER_FULL |
> +		       PATHSPEC_SYMLINK_LEADING_PATH,
> +		       prefix, argv);
> +#else
>  	/*
>  	 * git-add--interactive itself does not parse pathspec. It
>  	 * simply passes the pathspec to other builtin commands. Let's
> @@ -281,6 +293,7 @@ int interactive_add(int argc, const char **argv, const char *prefix, int patch)
>  		       PATHSPEC_SYMLINK_LEADING_PATH |
>  		       PATHSPEC_PREFIX_ORIGIN,
>  		       prefix, argv);
> +#endif
> [etc.]
-- Hannes
Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 5 of 10 in “nd/magic-pathspec exposes breakage in git-add--interactive on Windows”
  1. Johannes SixtAug 29, 2013
  2. Duy NguyenAug 29, 2013
  3. Alex RiesenAug 29, 2013
  4. Turn off pathspec magic on "{checkout,reset,add} -p" on native Windows buildsNguyễn Thái Ngọc Duy, Sep 1, 2013
  5. Johannes SixtSep 2, 2013
  6. Duy NguyenSep 2, 2013
  7. Johannes SixtSep 2, 2013
  8. Duy NguyenSep 2, 2013
  9. add--interactive: fix external command invocation on WindowsJohannes Sixt, Sep 4, 2013
  10. Duy NguyenSep 4, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.