Skip to content

Commit 3af8834

Browse files
committed
Parse absolute paths as local urls on Windows
The check done by Git is a bit more extensive (it checks that the first char is a possible dos driver letter), but this change should cover the most cases.
1 parent 5ac705c commit 3af8834

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

gix-url/src/parse/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ fn find_scheme(input: &BStr) -> InputScheme {
6666
if let Some(colon) = input.find_byte(b':') {
6767
// allow user to select files containing a `:` by passing them as absolute or relative path
6868
// this is behavior explicitly mentioned by the scp and git manuals
69-
if !&input[..colon].contains(&b'/') {
70-
// TODO: implement windows specific checks
69+
let explicitly_local = &input[..colon].contains(&b'/');
70+
let dos_driver_letter = cfg!(windows) && input[..colon].len() == 1;
71+
72+
if !explicitly_local && !dos_driver_letter {
7173
return InputScheme::Scp { colon };
7274
}
7375
}

0 commit comments

Comments
 (0)