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

Re: [PATCH 13/14] t4135-*.sh: Skip the "backslash" tests on cygwin

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Dec 16, 2010, 22:38 UTC
Message-ID
<4D0A94D8.6090206@ramsay1.demon.co.uk>
In-Reply-To
<201012142149.33725.j6t@kdbg.org>
Johannes Sixt wrote:
Show 9 quoted lines
> 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.)

ATB, Ramsay Jones

Previous: Johannes SixtNext: Johannes Sixt
Message 3 of 8 in “t4135-*.sh: Skip the "backslash" tests on cygwin”
  1. 13/14 t4135-*.sh: Skip the "backslash" tests on cygwinRamsay Jones, Dec 14, 2010
  2. Johannes SixtDec 14, 2010
  3. Ramsay JonesDec 16, 2010
  4. Johannes SixtDec 17, 2010
  5. Ramsay JonesDec 21, 2010
  6. Nguyen Thai Ngoc DuyDec 22, 2010
  7. Ramsay JonesDec 28, 2010
  8. Nguyen Thai Ngoc DuyDec 29, 2010

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.