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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 28/04/17 20:54, Johannes Sixt wrote:
> Am 28.04.2017 um 05:09 schrieb Junio C Hamano:
>> Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx> 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)!

> 
>>> @@ -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





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]