git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Cc: Junio C Hamano <gitster@pobox.com>,
	"GIT Mailing-list" <git@vger.kernel.org>,
	jrnieder@gmail.com
Subject: Re: [PATCH 13/14] t4135-*.sh: Skip the "backslash" tests on cygwin
Date: Fri, 17 Dec 2010 22:54:31 +0100	[thread overview]
Message-ID: <201012172254.31242.j6t@kdbg.org> (raw)
In-Reply-To: <4D0A94D8.6090206@ramsay1.demon.co.uk>

On Donnerstag, 16. Dezember 2010, Ramsay Jones wrote:
> Johannes Sixt wrote:
> > On Dienstag, 14. Dezember 2010, Ramsay Jones wrote:
> >> Note t3700-*.sh has a test protected by BSLASHSPEC which
> >> previously passed on cygwin and will now be (unnecessarily)
> >> skipped. This test needs to be skipped on MinGW, given how
> >> it is written; if you remove the single quotes around the
> >> filename, however, it will pass even on MinGW.
> >
> > That is suspicious. It would mean that git add does not do file globbing
> > anymore. Should it or should it not do file globbing?
>
> Hmm, something like "git add 'a.[ch]'" works just fine. The problems
> occur when you back-quote the metachars like "git add 'a.\[ch\]'".
>
> The test is skipped on MinGW, because of BSLASHSPEC. The test is now
> skipped on cygwin, after this patch, even though it passes on cygwin.
> BSLASHSPEC is, apparently, used for both a '\' in a filename and for
> a "\-quoting". (Perhaps it should be split into two prerequisites)
>
> The difference in behaviour between cygwin and MinGW (& msvc) is easy
> to trace, thus:
>
> cmd_add()
>     =>validate_pathspec() builtin/add.c:435
>         =>get_pathspec() builtin/add.c:216
>             =>prefix_path() setup.c:147
>                 =>normalize_path_copy() setup.c:18
>                     =>is_dir_sep()
>
> on cygwin is_dir_sep() is defined thus:
>
>     git-compat-util.h:208:#define is_dir_sep(c) ((c) == '/')
>
> where on MinGW it is defined thus:
>
>     compat/mingw.h:291:#define is_dir_sep(c) ((c) == '/' || (c) == '\\')
>
> So, on entry to git-add the pathspec (in argv[1]) is
>     fo\[ou\]bar
> On return from validate_pathspec(), on cygwin it is *still*
>     fo\[ou\]bar
> but on MinGW (and msvc), it is now
>     fo/[ou/]bar
>
> and everything follows from there. (So for example, on cygwin, match_one()
> matches fo\[ou\]bar with fo[ou]bar, but not with foobar.)

Yes, that's clear, and this is the reason that we must skip this test on 
MinGW.

But you said that when the single quotes are removed, the test passes (and you 
are right). Then git-add sees this pathspec/pattern:

    fo[ou]bar

and it matches 'foobar' when it interprets that as a pattern, but 'fo[ou]bar' 
when it interprets that as straight file name. Even on Linux, the latter 
happens, and *that* is suspicious. What am I missing?

-- Hannes

  reply	other threads:[~2010-12-17 21:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 18:37 [PATCH 13/14] t4135-*.sh: Skip the "backslash" tests on cygwin Ramsay Jones
2010-12-14 20:49 ` Johannes Sixt
2010-12-16 22:38   ` Ramsay Jones
2010-12-17 21:54     ` Johannes Sixt [this message]
2010-12-21 19:31       ` Ramsay Jones
2010-12-22  1:44         ` Nguyen Thai Ngoc Duy
2010-12-28 18:10           ` Ramsay Jones
2010-12-29 13:56             ` Nguyen Thai Ngoc Duy

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=201012172254.31242.j6t@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=ramsay@ramsay1.demon.co.uk \
    /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).