Skip to content

Commit

Permalink
fixup! Add functionality for converting UNIX paths in arguments and e…
Browse files Browse the repository at this point in the history
…nvironment variables to Windows form for native Win32 applications.

Do not let MSYS2's path conversion mistake arguments starting with '@@'
for being paths.

This addresses the expectations of the following test cases in the test
suite of https://github.com/git/git/tree/v2.43.0:

-t1508.1 setup
-t1508.2 HEAD = refs/heads/new-branch
-t1508.3 @{1} = new-one
-t1508.4 HEAD@{1} = new-one
-t1508.5 @{now} = new-two
-t1508.6 HEAD@{now} = new-two
-t1508.7 @{-1} = refs/heads/old-branch
-t1508.8 @{-1}@{0} = old-two
-t1508.9 @{-1}@{1} = old-one
-t1508.10 @{u} = refs/heads/upstream-branch
-t1508.11 HEAD@{u} = refs/heads/upstream-branch
-t1508.12 @{u}@{1} = upstream-one
-t1508.13 @{-1}@{u} = refs/heads/main
-t1508.14 @{-1}@{u}@{1} = main-one
-t1508.15 @ = new-two
-t1508.16 @@{u} = refs/heads/upstream-branch
-t1508.17 @@/at-test = refs/heads/@@/at-test
-t1508.18 @at-test = refs/heads/@at-test
-t1508.24 HEAD@{3} = old-two
-t1508.26 switch to old-branch
-t1508.27 HEAD = refs/heads/old-branch
-t1508.28 HEAD@{1} = new-two
-t1508.29 @{1} = old-one

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Dec 17, 2023
1 parent ad02a6c commit 9553100
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions winsup/cygwin/msys2_path_conv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,10 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en
goto skip_p2w;
}
break;
case '@':
// Paths do not contain '@@'
if (it + 1 < end && it[1] == '@')
goto skip_p2w;
}
++it;
}
Expand Down

0 comments on commit 9553100

Please sign in to comment.