Skip to content

Commit 1bf2620

Browse files
committed
---
yaml --- r: 145935 b: refs/heads/try2 c: 6f5b809 h: refs/heads/master i: 145933: 423fb10 145931: 0e14b50 145927: 8c2a90e 145919: bdfcab4 v: v3
1 parent ee2e09f commit 1bf2620

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 6d29142219d92f886124057e9ecfdb51ffca19f2
8+
refs/heads/try2: 6f5b809775fb1f8dbf27edded8e955d64377749c
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/path2/posix.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ impl GenericPathUnsafe for Path {
9797
Some(0) if self.repr.len() == 1 && self.repr[0] == sep => {
9898
self.repr = Path::normalize(dirname);
9999
}
100+
Some(idx) if self.repr.slice_from(idx+1) == bytes!("..") => {
101+
self.repr = Path::normalize(dirname);
102+
}
100103
Some(idx) if dirname.is_empty() => {
101104
let v = Path::normalize(self.repr.slice_from(idx+1));
102105
self.repr = v;
103106
}
104-
Some(idx) if self.repr.slice_from(idx+1) == bytes!("..") => {
105-
self.repr = Path::normalize(dirname);
106-
}
107107
Some(idx) => {
108108
let mut v = vec::with_capacity(dirname.len() + self.repr.len() - idx);
109109
v.push_all(dirname);
@@ -444,7 +444,9 @@ mod tests {
444444
t!(s: Path::from_str(""), ".");
445445
t!(s: Path::from_str("/"), "/");
446446
t!(s: Path::from_str("hi"), "hi");
447+
t!(s: Path::from_str("hi/"), "hi");
447448
t!(s: Path::from_str("/lib"), "/lib");
449+
t!(s: Path::from_str("/lib/"), "/lib");
448450
t!(s: Path::from_str("hi/there"), "hi/there");
449451
t!(s: Path::from_str("hi/there.txt"), "hi/there.txt");
450452

@@ -800,6 +802,8 @@ mod tests {
800802
t!(s: Path::from_str("/foo").with_dirname_str("bar"), "bar/foo");
801803
t!(s: Path::from_str("..").with_dirname_str("foo"), "foo");
802804
t!(s: Path::from_str("../..").with_dirname_str("foo"), "foo");
805+
t!(s: Path::from_str("..").with_dirname_str(""), ".");
806+
t!(s: Path::from_str("../..").with_dirname_str(""), ".");
803807
t!(s: Path::from_str("foo").with_dirname_str(".."), "../foo");
804808
t!(s: Path::from_str("foo").with_dirname_str("../.."), "../../foo");
805809
@@ -813,6 +817,8 @@ mod tests {
813817
t!(s: Path::from_str("/").with_filename_str("foo"), "/foo");
814818
t!(s: Path::from_str("/a").with_filename_str("foo"), "/foo");
815819
t!(s: Path::from_str("foo").with_filename_str("bar"), "bar");
820+
t!(s: Path::from_str("/").with_filename_str("foo/"), "/foo");
821+
t!(s: Path::from_str("/a").with_filename_str("foo/"), "/foo");
816822
t!(s: Path::from_str("a/b/c").with_filename_str(""), "a/b");
817823
t!(s: Path::from_str("a/b/c").with_filename_str("."), "a/b");
818824
t!(s: Path::from_str("a/b/c").with_filename_str(".."), "a");
@@ -822,6 +828,8 @@ mod tests {
822828
t!(s: Path::from_str("a/b/c").with_filename_str("/d"), "a/b/d");
823829
t!(s: Path::from_str("..").with_filename_str("foo"), "../foo");
824830
t!(s: Path::from_str("../..").with_filename_str("foo"), "../../foo");
831+
t!(s: Path::from_str("..").with_filename_str(""), "..");
832+
t!(s: Path::from_str("../..").with_filename_str(""), "../..");
825833
826834
t!(v: Path::new(b!("hi/there", 0x80, ".txt")).with_filestem(b!(0xff)),
827835
b!("hi/", 0xff, ".txt"));

0 commit comments

Comments
 (0)