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.

With this commit, the POSIX-to-Windows conversion also leaves Git's
`<rev>:./<name>` syntax alone. Such a string would otherwise be mistaken
for indicating a path list, but path lists are expected to contain only
absolute paths, which would not be the case here.

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

-t1506.4 correct relative file objects (1)
-t1506.5 correct relative file objects (2)
-t1506.6 correct relative file objects (3)
-t1506.7 correct relative file objects (4)
-t1506.14 relative path not found
-t1506.15 relative path outside worktree
-t1506.16 relative path when cwd is outside worktree
-t1513.5 empty prefix HEAD:./path
-t1513.6 valid prefix HEAD:./path
-t1513.7 valid prefix HEAD:../path
-t2070.4 restore a file on worktree from another ref
-t2070.5 restore a file in the index from another ref
-t2070.6 restore a file in both the index and worktree from another ref
-t2070.8 restore --worktree --staged uses HEAD as source
-t7900.33 start and stop macOS maintenance
-t7900.34 use launchctl list to prevent extra work
-t7900.35 start and stop Windows maintenance
-t7900.36 start and stop Linux/systemd maintenance
-t7900.37 start and stop when several schedulers are available
-t9300.195 Y: rewrite submodules
-t9304.6 import with submodule mapping
-t9304.7 paths adjusted for relative subdir

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho authored and lazka committed Dec 19, 2023
1 parent c94cf81 commit 9944652
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions winsup/cygwin/msys2_path_conv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,14 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en
// Avoid mangling IPv6 addresses
if (it + 1 < end && it[1] == ':')
goto skip_p2w;

// Leave Git's <rev>:./name syntax alone
if (it + 1 < end && it[1] == '.') {
if (it + 2 < end && it[2] == '/')
goto skip_p2w;
if (it + 3 < end && it[2] == '.' && it[3] == '/')
goto skip_p2w;
}
break;
}
++it;
Expand Down

0 comments on commit 9944652

Please sign in to comment.