|
57 | 57 | } else {
|
58 | 58 | let mut ita = path.components();
|
59 | 59 | let mut itb = base.components();
|
| 60 | + let mut comps: Vec<Component> = vec![]; |
60 | 61 |
|
61 | 62 | // ./foo and foo are the same
|
62 | 63 | if let Some(Component::CurDir) = ita.clone().next() {
|
|
65 | 66 | if let Some(Component::CurDir) = itb.clone().next() {
|
66 | 67 | itb.next();
|
67 | 68 | }
|
68 |
| - let mut comps: Vec<Component> = vec![]; |
| 69 | + |
69 | 70 | loop {
|
70 | 71 | match (ita.next(), itb.next()) {
|
71 | 72 | (None, None) => break,
|
@@ -144,6 +145,15 @@ mod utf8_paths {
|
144 | 145 | let mut ita = path.components();
|
145 | 146 | let mut itb = base.components();
|
146 | 147 | let mut comps: Vec<Utf8Component> = vec![];
|
| 148 | + |
| 149 | + // ./foo and foo are the same |
| 150 | + if let Some(Utf8Component::CurDir) = ita.clone().next() { |
| 151 | + ita.next(); |
| 152 | + } |
| 153 | + if let Some(Utf8Component::CurDir) = itb.clone().next() { |
| 154 | + itb.next(); |
| 155 | + } |
| 156 | + |
147 | 157 | loop {
|
148 | 158 | match (ita.next(), itb.next()) {
|
149 | 159 | (None, None) => break,
|
@@ -255,7 +265,7 @@ mod tests {
|
255 | 265 | assert_diff_paths(".", "foo", Some("../."));
|
256 | 266 | assert_diff_paths("foo", ".", Some("foo"));
|
257 | 267 | assert_diff_paths("/foo", "/.", Some("foo"));
|
258 |
| - |
| 268 | + |
259 | 269 | assert_diff_paths("./foo/bar/baz", "foo", Some("bar/baz"));
|
260 | 270 | assert_diff_paths("foo/bar/baz", "./foo", Some("bar/baz"));
|
261 | 271 | assert_diff_paths("./foo/bar/baz", "./foo", Some("bar/baz"));
|
|
0 commit comments