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

Re: [PATCH] t7400: add BSLASHPSPEC prerequisite to 'add with \\ in path'

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Apr 29, 2017, 00:15 UTC
Message-ID
<a575542a-e5b6-389f-e240-d5ac5a4b4107@ramsayjones.plus.com>
In-Reply-To
<7cd09c17-30a1-b157-2454-4c9b399a8628@kdbg.org>
On 28/04/17 20:54, Johannes Sixt wrote:
Show 13 quoted lines
> Am 28.04.2017 um 05:09 schrieb Junio C Hamano:
>> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
>>
>>> Commit cf9e55f494 ("submodule: prevent backslash expantion in submodule
>>> names", 07-04-2017) added a test which creates a git repository with
>>> some backslash characters in the name. This test cannot work on windows,
>>> since the backslash is used as the directory separator. In order to
>>> suppress this test on cygwin, MinGW and Git for Windows, we add the
>>> BSLASHPSPEC prerequisite. (see also commits 6fd1106aa4 and c51c0da222).
> 
> First, let me say that meaning of BSLASHPSPEC was
> "keeps backslaches in pathspec arguments" originally,
> but it apparently changed meaning since then.
Indeed. I started to give some of the history in the commit message, but
it was nearly 3am, so I punted with the 'see also commits 6fd1106aa4 and
c51c0da222' ... ;-)
 
> t7400.20 does not fail for the MinGW port because the
> test case only operates on the file system, but never
> checks whether an entry 'sub\with\backslash' is present
> in the index.

Ah, OK. I only looked at my (64-bit) MSYS2 build, which fails exactly the same as cygwin. Hmm, wait, let me just rebuild on MinGW64 ... indeed it passes (well it passes t7400.20, but it fails on t7400.11, 61, 63, 87 and 89)!

Show 13 quoted lines
> 
>>> @@ -273,7 +273,7 @@ test_expect_success 'submodule add with ./, /.. and // in path' '
>>>      test_cmp empty untracked
>>>  '
>>>
>>> -test_expect_success 'submodule add with \\ in path' '
>>> +test_expect_success BSLASHPSPEC 'submodule add with \\ in path' '
>>>      test_when_finished "rm -rf parent sub\\with\\backslash" &&
>>>
>>>      # Initialize a repo with a backslash in its name
>>
> 
> I assume the test fails right at 'git init' under Cygwin?
Indeed. Also on MSYS2 (exactly as on cygwin):
ramsay@satellite  MSYS $ ./t7400-submodule-basic.sh -i -v
...
ok 19 - submodule add with ./, /.. and // in path
expecting success:
        test_when_finished "rm -rf parent sub\\with\\backslash" &&
        # Initialize a repo with a backslash in its name
        git init sub\\with\\backslash &&
        touch sub\\with\\backslash/empty.file &&
        git -C sub\\with\\backslash add empty.file &&
        git -C sub\\with\\backslash commit -m "Added empty.file" &&
        # Add that repository as a submodule
        git init parent &&
        git -C parent submodule add ../sub\\with\\backslash

fatal: cannot mkdir sub\with\backslash: No such file or directory not ok 20 - submodule add with \\ in path # # test_when_finished "rm -rf parent sub\\with\\backslash" && # # # Initialize a repo with a backslash in its name # git init sub\\with\\backslash && # touch sub\\with\\backslash/empty.file && # git -C sub\\with\\backslash add empty.file && # git -C sub\\with\\backslash commit -m "Added empty.file" && # # # Add that repository as a submodule # git init parent && # git -C parent submodule add ../sub\\with\\backslash # ramsay@satellite MSYS $

ramsay@satellite  MSYS $ cd trash\ directory.t7400-submodule-basic/

ramsay@satellite MSYS $ ls a addtest/ empty expect-head head head-sha1 untracked actual addtest-ignore/ expect expect-heads heads t z

ramsay@satellite MSYS $ git init sub\\with\\backslash fatal: cannot mkdir sub\with\backslash: No such file or directory

ramsay@satellite  MSYS $ mkdir -p sub\\with

ramsay@satellite MSYS $ git init sub\\with\\backslash Initialized empty Git repository in /home/ramsay/git/t/trash directory.t7400-submodule-basic/sub/with/backslash/.git/

ramsay@satellite  MSYS $ touch sub\\with\\backslash/empty.file
ramsay@satellite  MSYS $ git -C sub\\with\\backslash add empty.file
ramsay@satellite  MSYS $ git -C sub\\with\\backslash commit -m "Added empty.file"
[master (root-commit) 6fde90b] Added empty.file
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 empty.file

ramsay@satellite MSYS $ git init parent Initialized empty Git repository in /home/ramsay/git/t/trash directory.t7400-submodule-basic/parent/.git/

ramsay@satellite MSYS $ git -C parent submodule add ../sub\\with\\backslash Cloning into '/home/ramsay/git/t/trash directory.t7400-submodule-basic/parent/sub/with/backslash'... done. fatal: Not a git repository: /home/ramsay/git/t/trash directory.t7400-submodule-basic/parent/sub\with\backslash/../.git/modules/sub/with/backslash

ramsay@satellite MSYS $ echo $? 128 ramsay@satellite MSYS $

Do you not see this on msys?
> 
> BSLASHPSPEC (with its *new* meaning) would be the
> right prerequisite if the check for the index entry
> were added. Until then, !CYGWIN is more appropriate.
OK, I'll re-roll the patch (tomorrow, it's late again).
Thanks.

ATB, Ramsay Jones

Previous: Johannes SixtNext: Johannes Sixt
Message 4 of 9 in “t7400: add BSLASHPSPEC prerequisite to 'add with \\ in path'”
  1. t7400: add BSLASHPSPEC prerequisite to 'add with \\ in path'Ramsay Jones, Apr 28, 2017
  2. Junio C HamanoApr 28, 2017
  3. Johannes SixtApr 28, 2017
  4. Ramsay JonesApr 29, 2017
  5. Johannes SixtApr 29, 2017
  6. Johannes SchindelinApr 29, 2017
  7. Ramsay JonesApr 30, 2017
  8. Johannes SchindelinMay 1, 2017
  9. Ramsay JonesApr 30, 2017

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.