1
- use assert_matches:: assert_matches;
2
1
use bstr:: ByteSlice ;
3
2
use gix_url:: Scheme ;
4
3
@@ -93,11 +92,19 @@ fn no_relative_paths_if_protocol() -> crate::Result {
93
92
assert_url_roundtrip ( "file://../" , url ( Scheme :: File , None , ".." , None , b"/" ) ) ?;
94
93
assert_url_roundtrip ( "file://./" , url ( Scheme :: File , None , "." , None , b"/" ) ) ?;
95
94
assert_url_roundtrip ( "file://a/" , url ( Scheme :: File , None , "a" , None , b"/" ) ) ?;
96
- assert_matches ! (
95
+ if cfg ! ( windows) {
96
+ assert_eq ! (
97
+ gix_url:: parse( "file://.\\ " . into( ) ) ?,
98
+ url( Scheme :: File , None , "." , None , b"\\ " ) ,
99
+ "we are just as none-sensical as git here due to special handling."
100
+ ) ;
101
+ } else {
102
+ assert_matches:: assert_matches!(
97
103
gix_url:: parse( "file://.\\ " . into( ) ) ,
98
104
Err ( gix_url:: parse:: Error :: MissingRepositoryPath { .. } ) ,
99
105
"DEVIATION: on windows, this parses with git into something nonesensical Diag: url=file://./ Diag: protocol=file Diag: hostandport=./ Diag: path=//./"
100
106
) ;
107
+ }
101
108
Ok ( ( ) )
102
109
}
103
110
@@ -122,6 +129,15 @@ mod windows {
122
129
use crate :: parse:: { assert_url, assert_url_roundtrip, url, url_alternate} ;
123
130
use gix_url:: Scheme ;
124
131
132
+ #[ test]
133
+ fn reproduce_1063 ( ) -> crate :: Result {
134
+ let input = "C:\\ Users\\ RUNNER~1\\ AppData\\ Local\\ Temp\\ tmp.vIa4tyjv17" ;
135
+ let url_input = "file://C:\\ Users\\ RUNNER~1\\ AppData\\ Local\\ Temp\\ tmp.vIa4tyjv17" ;
136
+ assert_url ( url_input, url ( Scheme :: File , None , None , None , input. as_bytes ( ) ) ) ?;
137
+ assert_url ( input, url_alternate ( Scheme :: File , None , None , None , input. as_bytes ( ) ) ) ?;
138
+ Ok ( ( ) )
139
+ }
140
+
125
141
#[ test]
126
142
fn url_from_absolute_path ( ) -> crate :: Result {
127
143
assert_url (
0 commit comments