Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognize path lists starting with absolute or relative paths again #212

Draft
wants to merge 1 commit into
base: msys2-3.4.10
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion winsup/cygwin/msys2_path_conv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,18 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en
return NONE;
}

/*
* Discern between Git's `<rev>:<path>`, SCP's `<host>:<path>` pattern
* (which is not a path list but may naïvely look like one) on the one
* hand, and path lists starting with `/<path>`, `./<path>` or `../<path>`
* on the other hand.
*/
bool potential_path_list = *it == '/' ||
(*it == '.' &&
(it[1] == ':' || it[1] == '/' ||
(it[1] == '.' &&
(it[2] == ':' || it[2] == '/'))));

/*
* Prevent Git's :file.txt and :/message syntax from beeing modified.
*/
Expand All @@ -383,7 +395,7 @@ path_type find_path_start_and_type(const char** src, int recurse, const char* en
goto skip_p2w;

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