History

Merge pull request #1909 from cruessler/take-to-components-in-fs-stack

Accept `ToComponents` in `gix_fs::Stack`

Sebastian Thiel committed 1 year ago

Commit 5cb53372 parents bfa3253 1f98edb20 files · +177 −102Browse files

Unified · Split

20 files
  1. .github/workflows/msrv.yml +1 −1
  2. Cargo.lock +3 −0
  3. etc/msrv-badge.svg +3 −3
  4. gitoxide-core/src/repository/attributes/query.rs +3 −3
  5. gitoxide-core/src/repository/exclude.rs +1 −1
  6. gix-fs/Cargo.toml +4 −1
  7. gix-fs/src/stack.rs +93 −18
  8. gix-fs/tests/fs/stack.rs +33 −31
  9. gix-protocol/src/fetch/response/async_io.rs +1 −1
  10. gix-status/src/stack.rs +4 −4
  11. gix-status/tests/status/stack.rs +6 −12
  12. gix-worktree-state/src/checkout/entry.rs +1 −1
  13. gix-worktree/Cargo.toml +1 −1
  14. gix-worktree/src/stack/mod.rs +4 −11
  15. gix-worktree/tests/worktree/stack/create_directory.rs +4 −2
  16. gix-worktree/tests/worktree/stack/ignore.rs +6 −3
  17. gix/Cargo.toml +1 −1
  18. gix/src/attribute_stack.rs +6 −6
  19. gix/src/id.rs +1 −1
  20. tests/it/src/commands/copy_royal.rs +1 −1
.github/workflows/msrv.yml+1−1
@@ -31,7 +31,7 @@ jobs: · 30 unmodified lines
31 env:31 env:
32 # dictated by `firefox` to support the `helix` editor, but now probably effectively be controlled by `jiff`, which also aligns with `regex`.32 # dictated by `firefox` to support the `helix` editor, but now probably effectively be controlled by `jiff`, which also aligns with `regex`.
33 # IMPORTANT: adjust etc/msrv-badge.svg as well33 # IMPORTANT: adjust etc/msrv-badge.svg as well
34 rust_version: 1.74.034 rust_version: 1.75.0
35 35
36 steps:36 steps:
37 - uses: actions/checkout@v437 - uses: actions/checkout@v4
Cargo.lock+3−0
@@ -1901,13 +1901,16 @@ dependencies = [ · 1900 unmodified lines
1901name = "gix-fs"1901name = "gix-fs"
1902version = "0.13.0"1902version = "0.13.0"
1903dependencies = [1903dependencies = [
1904 "bstr",
1904 "crossbeam-channel",1905 "crossbeam-channel",
1905 "fastrand",1906 "fastrand",
1906 "gix-features 0.40.0",1907 "gix-features 0.40.0",
1908 "gix-path 0.10.14",
1907 "gix-utils 0.1.14",1909 "gix-utils 0.1.14",
1908 "is_ci",1910 "is_ci",
1909 "serde",1911 "serde",
1910 "tempfile",1912 "tempfile",
1913 "thiserror 2.0.12",
1911]1914]
1912 1915
1913[[package]]1916[[package]]
etc/msrv-badge.svg+3−3
@@ -1,5 +1,5 @@
1<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="92" height="20" role="img" aria-label="rustc: 1.70.0+">1<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="92" height="20" role="img" aria-label="rustc: 1.70.0+">
2 <title>rustc: 1.74.0+</title>2 <title>rustc: 1.75.0+</title>
3 <linearGradient id="s" x2="0" y2="100%">3 <linearGradient id="s" x2="0" y2="100%">
4 <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>4 <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
5 <stop offset="1" stop-opacity=".1"/>5 <stop offset="1" stop-opacity=".1"/>
@@ -15,7 +15,7 @@ · 9 unmodified lines
15 <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">15 <g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110">
16 <text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">rustc</text>16 <text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">rustc</text>
17 <text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">rustc</text>17 <text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">rustc</text>
18 <text aria-hidden="true" x="635" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">1.74.0+</text>18 <text aria-hidden="true" x="635" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="450">1.75.0+</text>
19 <text x="635" y="140" transform="scale(.1)" fill="#fff" textLength="450">1.74.0+</text>19 <text x="635" y="140" transform="scale(.1)" fill="#fff" textLength="450">1.75.0+</text>
20 </g>20 </g>
21</svg>21</svg>
gitoxide-core/src/repository/attributes/query.rs+3−3
@@ -8,10 +8,10 @@ pub struct Options { · 7 unmodified lines
8}8}
9 9
10pub(crate) mod function {10pub(crate) mod function {
11 use std::{borrow::Cow, io, path::Path};
12
13 use anyhow::bail;11 use anyhow::bail;
14 use gix::bstr::BStr;12 use gix::bstr::BStr;
13 use std::borrow::Cow;
14 use std::{io, path::Path};
15 15
16 use crate::{16 use crate::{
17 is_dir_to_mode,17 is_dir_to_mode,
@@ -44,7 +44,7 @@ pub(crate) mod function { · 26 unmodified lines
44 .ok()44 .ok()
45 .map(|m| is_dir_to_mode(m.is_dir()));45 .map(|m| is_dir_to_mode(m.is_dir()));
46 46
47 let entry = cache.at_entry(path.as_slice(), mode)?;47 let entry = cache.at_entry(&path, mode)?;
48 if !entry.matching_attributes(&mut matches) {48 if !entry.matching_attributes(&mut matches) {
49 continue;49 continue;
50 }50 }
gitoxide-core/src/repository/exclude.rs+1−1
@@ -48,7 +48,7 @@ pub fn query( · 47 unmodified lines
48 .metadata()48 .metadata()
49 .ok()49 .ok()
50 .map(|m| is_dir_to_mode(m.is_dir()));50 .map(|m| is_dir_to_mode(m.is_dir()));
51 let entry = cache.at_entry(path.as_slice(), mode)?;51 let entry = cache.at_entry(&path, mode)?;
52 let match_ = entry52 let match_ = entry
53 .matching_exclude_pattern()53 .matching_exclude_pattern()
54 .and_then(|m| (show_ignore_patterns || !m.pattern.is_negative()).then_some(m));54 .and_then(|m| (show_ignore_patterns || !m.pattern.is_negative()).then_some(m));
gix-fs/Cargo.toml+4−1
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" · 7 unmodified lines
8description = "A crate providing file system specific utilities to `gitoxide`"8description = "A crate providing file system specific utilities to `gitoxide`"
9authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]9authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
10edition = "2021"10edition = "2021"
11rust-version = "1.70"11rust-version = "1.75"
12include = ["src/**/*", "LICENSE-*"]12include = ["src/**/*", "LICENSE-*"]
13 13
14[lib]14[lib]
@@ -19,8 +19,11 @@ doctest = false · 4 unmodified lines
19serde = ["dep:serde"]19serde = ["dep:serde"]
20 20
21[dependencies]21[dependencies]
22bstr = "1.5.0"
23gix-path = { version = "^0.10.14", path = "../gix-path" }
22gix-features = { version = "^0.40.0", path = "../gix-features", features = ["fs-read-dir"] }24gix-features = { version = "^0.40.0", path = "../gix-features", features = ["fs-read-dir"] }
23gix-utils = { version = "^0.1.14", path = "../gix-utils" }25gix-utils = { version = "^0.1.14", path = "../gix-utils" }
26thiserror = "2.0.0"
24serde = { version = "1.0.114", optional = true, default-features = false, features = ["std", "derive"] }27serde = { version = "1.0.114", optional = true, default-features = false, features = ["std", "derive"] }
25 28
26# For `Capabilities` to assure parallel operation works.29# For `Capabilities` to assure parallel operation works.
gix-fs/src/stack.rs+93−18
@@ -1,6 +1,80 @@
1use crate::Stack;
2use bstr::{BStr, BString, ByteSlice};
3use std::ffi::OsStr;
1use std::path::{Component, Path, PathBuf};4use std::path::{Component, Path, PathBuf};
2 5
3use crate::Stack;6///
7pub mod to_normal_path_components {
8 use std::ffi::OsString;
9
10 /// The error used in [`ToNormalPathComponents::to_normal_path_components()`](super::ToNormalPathComponents::to_normal_path_components()).
11 #[derive(Debug, thiserror::Error)]
12 #[allow(missing_docs)]
13 pub enum Error {
14 #[error("Input path \"{path}\" contains relative or absolute components", path = std::path::Path::new(.0.as_os_str()).display())]
15 NotANormalComponent(OsString),
16 #[error("Could not convert to UTF8 or from UTF8 due to ill-formed input")]
17 IllegalUtf8,
18 }
19}
20
21/// Obtain an iterator over `OsStr`-components which are normal, none-relative and not absolute.
22pub trait ToNormalPathComponents {
23 /// Return an iterator over the normal components of a path, without the separator.
24 fn to_normal_path_components(&self) -> impl Iterator<Item = Result<&OsStr, to_normal_path_components::Error>>;
25}
26
27impl ToNormalPathComponents for &Path {
28 fn to_normal_path_components(&self) -> impl Iterator<Item = Result<&OsStr, to_normal_path_components::Error>> {
29 self.components().map(|component| match component {
30 Component::Normal(os_str) => Ok(os_str),
31 _ => Err(to_normal_path_components::Error::NotANormalComponent(
32 self.as_os_str().to_owned(),
33 )),
34 })
35 }
36}
37
38impl ToNormalPathComponents for PathBuf {
39 fn to_normal_path_components(&self) -> impl Iterator<Item = Result<&OsStr, to_normal_path_components::Error>> {
40 self.components().map(|component| match component {
41 Component::Normal(os_str) => Ok(os_str),
42 _ => Err(to_normal_path_components::Error::NotANormalComponent(
43 self.as_os_str().to_owned(),
44 )),
45 })
46 }
47}
48
49impl ToNormalPathComponents for &BStr {
50 fn to_normal_path_components(&self) -> impl Iterator<Item = Result<&OsStr, to_normal_path_components::Error>> {
51 self.split(|b| *b == b'/').filter(|c| !c.is_empty()).map(|component| {
52 gix_path::try_from_byte_slice(component.as_bstr())
53 .map_err(|_| to_normal_path_components::Error::IllegalUtf8)
54 .map(Path::as_os_str)
55 })
56 }
57}
58
59impl ToNormalPathComponents for &str {
60 fn to_normal_path_components(&self) -> impl Iterator<Item = Result<&OsStr, to_normal_path_components::Error>> {
61 self.split('/').filter(|c| !c.is_empty()).map(|component| {
62 gix_path::try_from_byte_slice(component.as_bytes())
63 .map_err(|_| to_normal_path_components::Error::IllegalUtf8)
64 .map(Path::as_os_str)
65 })
66 }
67}
68
69impl ToNormalPathComponents for &BString {
70 fn to_normal_path_components(&self) -> impl Iterator<Item = Result<&OsStr, to_normal_path_components::Error>> {
71 self.split(|b| *b == b'/').filter(|c| !c.is_empty()).map(|component| {
72 gix_path::try_from_byte_slice(component.as_bstr())
73 .map_err(|_| to_normal_path_components::Error::IllegalUtf8)
74 .map(Path::as_os_str)
75 })
76 }
77}
4 78
5/// Access79/// Access
6impl Stack {80impl Stack {
@@ -62,8 +136,13 @@ impl Stack { · 55 unmodified lines
62 /// `relative` paths are terminal, so point to their designated file or directory.136 /// `relative` paths are terminal, so point to their designated file or directory.
63 /// The path is also expected to be normalized, and should not contain extra separators, and must not contain `..`137 /// The path is also expected to be normalized, and should not contain extra separators, and must not contain `..`
64 /// or have leading or trailing slashes (or additionally backslashes on Windows).138 /// or have leading or trailing slashes (or additionally backslashes on Windows).
65 pub fn make_relative_path_current(&mut self, relative: &Path, delegate: &mut dyn Delegate) -> std::io::Result<()> {139 pub fn make_relative_path_current(
66 if self.valid_components != 0 && relative.as_os_str().is_empty() {140 &mut self,
141 relative: impl ToNormalPathComponents,
142 delegate: &mut dyn Delegate,
143 ) -> std::io::Result<()> {
144 let mut components = relative.to_normal_path_components().peekable();
145 if self.valid_components != 0 && components.peek().is_none() {
67 return Err(std::io::Error::new(146 return Err(std::io::Error::new(
68 std::io::ErrorKind::Other,147 std::io::ErrorKind::Other,
69 "empty inputs are not allowed",148 "empty inputs are not allowed",
@@ -73,15 +152,19 @@ impl Stack { · 3 unmodified lines
73 delegate.push_directory(self)?;152 delegate.push_directory(self)?;
74 }153 }
75 154
76 let mut components = relative.components().peekable();
77 let mut existing_components = self.current_relative.components();155 let mut existing_components = self.current_relative.components();
78 let mut matching_components = 0;156 let mut matching_components = 0;
79 while let (Some(existing_comp), Some(new_comp)) = (existing_components.next(), components.peek()) {157 while let (Some(existing_comp), Some(new_comp)) = (existing_components.next(), components.peek()) {
80 if existing_comp == *new_comp {158 match new_comp {
81 components.next();159 Ok(new_comp) => {
82 matching_components += 1;160 if existing_comp.as_os_str() == *new_comp {
83 } else {161 components.next();
84 break;162 matching_components += 1;
163 } else {
164 break;
165 }
166 }
167 Err(err) => return Err(std::io::Error::other(format!("{err}"))),
85 }168 }
86 }169 }
87 170
@@ -100,15 +183,7 @@ impl Stack { · 12 unmodified lines
100 }183 }
101 184
102 while let Some(comp) = components.next() {185 while let Some(comp) = components.next() {
103 if !matches!(comp, Component::Normal(_)) {186 let comp = comp.map_err(std::io::Error::other)?;
104 return Err(std::io::Error::new(
105 std::io::ErrorKind::Other,
106 format!(
107 "Input path \"{}\" contains relative or absolute components",
108 relative.display()
109 ),
110 ));
111 }
112 let is_last_component = components.peek().is_none();187 let is_last_component = components.peek().is_none();
113 self.current_is_directory = !is_last_component;188 self.current_is_directory = !is_last_component;
114 self.current.push(comp);189 self.current.push(comp);
gix-fs/tests/fs/stack.rs+33−31
@@ -182,7 +182,7 @@ fn empty_paths_are_noop_if_no_path_was_pushed_before() { · 181 unmodified lines
182 let mut s = Stack::new(root.clone());182 let mut s = Stack::new(root.clone());
183 183
184 let mut r = Record::default();184 let mut r = Record::default();
185 s.make_relative_path_current("".as_ref(), &mut r).unwrap();185 s.make_relative_path_current("", &mut r).unwrap();
186 assert_eq!(186 assert_eq!(
187 s.current_relative().to_string_lossy(),187 s.current_relative().to_string_lossy(),
188 "",188 "",
@@ -196,7 +196,7 @@ fn relative_components_are_invalid() { · 7 unmodified lines
196 let mut s = Stack::new(root.clone());196 let mut s = Stack::new(root.clone());
197 197
198 let mut r = Record::default();198 let mut r = Record::default();
199 let err = s.make_relative_path_current("a/..".as_ref(), &mut r).unwrap_err();199 let err = s.make_relative_path_current(p("a/.."), &mut r).unwrap_err();
200 assert_eq!(200 assert_eq!(
201 err.to_string(),201 err.to_string(),
202 format!(202 format!(
@@ -205,7 +205,7 @@ fn relative_components_are_invalid() { · 2 unmodified lines
205 )205 )
206 );206 );
207 207
208 s.make_relative_path_current("a/./b".as_ref(), &mut r)208 s.make_relative_path_current(p("a/./b"), &mut r)
209 .expect("dot is ignored");209 .expect("dot is ignored");
210 assert_eq!(210 assert_eq!(
211 r,211 r,
@@ -221,7 +221,7 @@ fn relative_components_are_invalid() { · 9 unmodified lines
221 if cfg!(windows) { r".\a\b" } else { "./a/b" },221 if cfg!(windows) { r".\a\b" } else { "./a/b" },
222 "dot is silently ignored"222 "dot is silently ignored"
223 );223 );
224 s.make_relative_path_current("a//b/".as_ref(), &mut r)224 s.make_relative_path_current(p("a//b/"), &mut r)
225 .expect("multiple-slashes are ignored");225 .expect("multiple-slashes are ignored");
226 assert_eq!(226 assert_eq!(
227 r,227 r,
@@ -240,19 +240,19 @@ fn absolute_paths_are_invalid() -> crate::Result { · 12 unmodified lines
240 let mut s = Stack::new(root.clone());240 let mut s = Stack::new(root.clone());
241 241
242 let mut r = Record::default();242 let mut r = Record::default();
243 let err = s.make_relative_path_current("/".as_ref(), &mut r).unwrap_err();243 let err = s.make_relative_path_current(p("/"), &mut r).unwrap_err();
244 assert_eq!(244 assert_eq!(
245 err.to_string(),245 err.to_string(),
246 r#"Input path "/" contains relative or absolute components"#,246 r#"Input path "/" contains relative or absolute components"#,
247 "a leading slash is always considered absolute"247 "a leading slash is always considered absolute"
248 );248 );
249 s.make_relative_path_current("a/".as_ref(), &mut r)?;249 s.make_relative_path_current(p("a/"), &mut r)?;
250 assert_eq!(250 assert_eq!(
251 s.current(),251 s.current(),
252 p("./a/"),252 p("./a/"),
253 "trailing slashes aren't a problem at this stage, as they cannot cause a 'breakout'"253 "trailing slashes aren't a problem at this stage, as they cannot cause a 'breakout'"
254 );254 );
255 s.make_relative_path_current(r"b\".as_ref(), &mut r)?;255 s.make_relative_path_current(p(r"b\"), &mut r)?;
256 assert_eq!(256 assert_eq!(
257 s.current(),257 s.current(),
258 p(r"./b\"),258 p(r"./b\"),
@@ -261,7 +261,7 @@ fn absolute_paths_are_invalid() -> crate::Result { · 2 unmodified lines
261 261
262 #[cfg(windows)]262 #[cfg(windows)]
263 {263 {
264 let err = s.make_relative_path_current(r"\".as_ref(), &mut r).unwrap_err();264 let err = s.make_relative_path_current(Path::new(r"\"), &mut r).unwrap_err();
265 assert_eq!(265 assert_eq!(
266 err.to_string(),266 err.to_string(),
267 r#"Input path "\" contains relative or absolute components"#,267 r#"Input path "\" contains relative or absolute components"#,
@@ -269,20 +269,20 @@ fn absolute_paths_are_invalid() -> crate::Result { · 1 unmodified line
269 hence they are forbidden."269 hence they are forbidden."
270 );270 );
271 271
272 let err = s.make_relative_path_current("c:".as_ref(), &mut r).unwrap_err();272 let err = s.make_relative_path_current(Path::new("c:"), &mut r).unwrap_err();
273 assert_eq!(273 assert_eq!(
274 err.to_string(),274 err.to_string(),
275 r#"Input path "c:" contains relative or absolute components"#,275 r#"Input path "c:" contains relative or absolute components"#,
276 "on Windows, drive-letters without trailing backslash or slash are also absolute (even though they ought to be relative)"276 "on Windows, drive-letters without trailing backslash or slash are also absolute (even though they ought to be relative)"
277 );277 );
278 let err = s.make_relative_path_current(r"c:\".as_ref(), &mut r).unwrap_err();278 let err = s.make_relative_path_current(Path::new(r"c:\"), &mut r).unwrap_err();
279 assert_eq!(279 assert_eq!(
280 err.to_string(),280 err.to_string(),
281 r#"Input path "c:\" contains relative or absolute components"#,281 r#"Input path "c:\" contains relative or absolute components"#,
282 "on Windows, drive-letters are absolute, which is expected"282 "on Windows, drive-letters are absolute, which is expected"
283 );283 );
284 284
285 s.make_relative_path_current("֍:".as_ref(), &mut r)?;285 s.make_relative_path_current(Path::new("֍:"), &mut r)?;
286 assert_eq!(286 assert_eq!(
287 s.current().to_string_lossy(),287 s.current().to_string_lossy(),
288 ".\\֍:",288 ".\\֍:",
@@ -290,7 +290,7 @@ fn absolute_paths_are_invalid() -> crate::Result { · 1 unmodified line
290 but we just turn it into a presumably invalid path which is fine, i.e. we get a joined path"290 but we just turn it into a presumably invalid path which is fine, i.e. we get a joined path"
291 );291 );
292 let err = s292 let err = s
293 .make_relative_path_current(r"\\localhost\hello".as_ref(), &mut r)293 .make_relative_path_current(Path::new(r"\\localhost\hello"), &mut r)
294 .unwrap_err();294 .unwrap_err();
295 assert_eq!(295 assert_eq!(
296 err.to_string(),296 err.to_string(),
@@ -298,7 +298,9 @@ fn absolute_paths_are_invalid() -> crate::Result { · 1 unmodified line
298 "there is UNC paths as well"298 "there is UNC paths as well"
299 );299 );
300 300
301 let err = s.make_relative_path_current(r#"\\?\C:"#.as_ref(), &mut r).unwrap_err();301 let err = s
302 .make_relative_path_current(Path::new(r#"\\?\C:"#), &mut r)
303 .unwrap_err();
302 assert_eq!(304 assert_eq!(
303 err.to_string(),305 err.to_string(),
304 r#"Input path "\\?\C:" contains relative or absolute components"#,306 r#"Input path "\\?\C:" contains relative or absolute components"#,
@@ -314,10 +316,10 @@ fn delegate_calls_are_consistent() -> crate::Result { · 9 unmodified lines
314 let mut s = Stack::new(root.clone());316 let mut s = Stack::new(root.clone());
315 317
316 assert_eq!(s.current(), root);318 assert_eq!(s.current(), root);
317 assert_eq!(s.current_relative(), Path::new(""));319 assert_eq!(s.current_relative(), p(""));
318 320
319 let mut r = Record::default();321 let mut r = Record::default();
320 s.make_relative_path_current("a/b".as_ref(), &mut r)?;322 s.make_relative_path_current("a/b", &mut r)?;
321 let mut dirs = vec![root.clone(), root.join("a")];323 let mut dirs = vec![root.clone(), root.join("a")];
322 assert_eq!(324 assert_eq!(
323 r,325 r,
@@ -329,7 +331,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 5 unmodified lines
329 "it pushes the root-directory first, then the intermediate one"331 "it pushes the root-directory first, then the intermediate one"
330 );332 );
331 333
332 s.make_relative_path_current("a/b2".as_ref(), &mut r)?;334 s.make_relative_path_current("a/b2", &mut r)?;
333 assert_eq!(335 assert_eq!(
334 r,336 r,
335 Record {337 Record {
@@ -340,7 +342,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 4 unmodified lines
340 "dirs remain the same as b2 is a leaf/file, hence the new `push`"342 "dirs remain the same as b2 is a leaf/file, hence the new `push`"
341 );343 );
342 344
343 s.make_relative_path_current("c/d/e".as_ref(), &mut r)?;345 s.make_relative_path_current("c/d/e", &mut r)?;
344 dirs.pop();346 dirs.pop();
345 dirs.extend([root.join("c"), root.join("c").join("d")]);347 dirs.extend([root.join("c"), root.join("c").join("d")]);
346 assert_eq!(348 assert_eq!(
@@ -354,7 +356,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 7 unmodified lines
354 );356 );
355 357
356 dirs.push(root.join("c").join("d").join("x"));358 dirs.push(root.join("c").join("d").join("x"));
357 s.make_relative_path_current("c/d/x/z".as_ref(), &mut r)?;359 s.make_relative_path_current("c/d/x/z", &mut r)?;
358 assert_eq!(360 assert_eq!(
359 r,361 r,
360 Record {362 Record {
@@ -366,8 +368,8 @@ fn delegate_calls_are_consistent() -> crate::Result { · 5 unmodified lines
366 );368 );
367 369
368 dirs.drain(1..).count();370 dirs.drain(1..).count();
369 s.make_relative_path_current("f".as_ref(), &mut r)?;371 s.make_relative_path_current("f", &mut r)?;
370 assert_eq!(s.current_relative(), Path::new("f"));372 assert_eq!(s.current_relative(), p("f"));
371 assert_eq!(373 assert_eq!(
372 r,374 r,
373 Record {375 Record {
@@ -379,7 +381,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 5 unmodified lines
379 );381 );
380 382
381 dirs.push(root.join("x"));383 dirs.push(root.join("x"));
382 s.make_relative_path_current("x/z".as_ref(), &mut r)?;384 s.make_relative_path_current("x/z", &mut r)?;
383 assert_eq!(385 assert_eq!(
384 r,386 r,
385 Record {387 Record {
@@ -391,7 +393,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 5 unmodified lines
391 );393 );
392 394
393 dirs.push(root.join("x").join("z"));395 dirs.push(root.join("x").join("z"));
394 s.make_relative_path_current("x/z/a".as_ref(), &mut r)?;396 s.make_relative_path_current("x/z/a", &mut r)?;
395 assert_eq!(397 assert_eq!(
396 r,398 r,
397 Record {399 Record {
@@ -404,7 +406,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 6 unmodified lines
404 406
405 dirs.push(root.join("x").join("z").join("a"));407 dirs.push(root.join("x").join("z").join("a"));
406 dirs.push(root.join("x").join("z").join("a").join("b"));408 dirs.push(root.join("x").join("z").join("a").join("b"));
407 s.make_relative_path_current("x/z/a/b/c".as_ref(), &mut r)?;409 s.make_relative_path_current("x/z/a/b/c", &mut r)?;
408 assert_eq!(410 assert_eq!(
409 r,411 r,
410 Record {412 Record {
@@ -416,7 +418,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 5 unmodified lines
416 );418 );
417 419
418 dirs.drain(1 /*root*/ + 1 /*x*/ + 1 /*x/z*/ ..).count();420 dirs.drain(1 /*root*/ + 1 /*x*/ + 1 /*x/z*/ ..).count();
419 s.make_relative_path_current("x/z".as_ref(), &mut r)?;421 s.make_relative_path_current("x/z", &mut r)?;
420 assert_eq!(422 assert_eq!(
421 r,423 r,
422 Record {424 Record {
@@ -432,7 +434,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 9 unmodified lines
432 "the stack is state so keeps thinking it's a directory which is consistent. Git does it differently though."434 "the stack is state so keeps thinking it's a directory which is consistent. Git does it differently though."
433 );435 );
434 436
435 let err = s.make_relative_path_current("".as_ref(), &mut r).unwrap_err();437 let err = s.make_relative_path_current(p(""), &mut r).unwrap_err();
436 assert_eq!(438 assert_eq!(
437 err.to_string(),439 err.to_string(),
438 "empty inputs are not allowed",440 "empty inputs are not allowed",
@@ -440,7 +442,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 1 unmodified line
440 and besides that really shouldn't happen"442 and besides that really shouldn't happen"
441 );443 );
442 444
443 s.make_relative_path_current("leaf".as_ref(), &mut r)?;445 s.make_relative_path_current("leaf", &mut r)?;
444 dirs.drain(1..).count();446 dirs.drain(1..).count();
445 assert_eq!(447 assert_eq!(
446 r,448 r,
@@ -452,7 +454,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 5 unmodified lines
452 "reset as much as possible, with just a leaf-component and the root directory"454 "reset as much as possible, with just a leaf-component and the root directory"
453 );455 );
454 456
455 s.make_relative_path_current("a//b".as_ref(), &mut r)?;457 s.make_relative_path_current(p("a//b"), &mut r)?;
456 dirs.push(root.join("a"));458 dirs.push(root.join("a"));
457 assert_eq!(459 assert_eq!(
458 r,460 r,
@@ -466,7 +468,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 7 unmodified lines
466 468
467 #[cfg(not(windows))]469 #[cfg(not(windows))]
468 {470 {
469 s.make_relative_path_current(r"\/b".as_ref(), &mut r)?;471 s.make_relative_path_current(r"\/b", &mut r)?;
470 dirs.pop();472 dirs.pop();
471 dirs.push(root.join(r"\"));473 dirs.push(root.join(r"\"));
472 assert_eq!(474 assert_eq!(
@@ -479,7 +481,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 6 unmodified lines
479 "a backslash is a normal character outside of Windows, so it's fine to have it as component"481 "a backslash is a normal character outside of Windows, so it's fine to have it as component"
480 );482 );
481 483
482 s.make_relative_path_current(r"\".as_ref(), &mut r)?;484 s.make_relative_path_current(r"\", &mut r)?;
483 assert_eq!(485 assert_eq!(
484 r,486 r,
485 Record {487 Record {
@@ -494,7 +496,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 8 unmodified lines
494 r"a backslash can also be a valid leaf component - here we only popped the 'b', leaving the \ 'directory'"496 r"a backslash can also be a valid leaf component - here we only popped the 'b', leaving the \ 'directory'"
495 );497 );
496 498
497 s.make_relative_path_current(r"\\".as_ref(), &mut r)?;499 s.make_relative_path_current(r"\\", &mut r)?;
498 dirs.pop();500 dirs.pop();
499 assert_eq!(501 assert_eq!(
500 r,502 r,
@@ -513,7 +515,7 @@ fn delegate_calls_are_consistent() -> crate::Result { · 12 unmodified lines
513 515
514 #[cfg(windows)]516 #[cfg(windows)]
515 {517 {
516 s.make_relative_path_current(r"c\/d".as_ref(), &mut r)?;518 s.make_relative_path_current(Path::new(r"c\/d"), &mut r)?;
517 dirs.pop();519 dirs.pop();
518 dirs.push(root.join("c"));520 dirs.push(root.join("c"));
519 assert_eq!(521 assert_eq!(
gix-protocol/src/fetch/response/async_io.rs+1−1
@@ -124,7 +124,7 @@ impl Response { · 123 unmodified lines
124 io::ErrorKind::UnexpectedEof,124 io::ErrorKind::UnexpectedEof,
125 "Could not read message headline",125 "Could not read message headline",
126 )));126 )));
127 };127 }
128 128
129 match line.trim_end() {129 match line.trim_end() {
130 "acknowledgments" => {130 "acknowledgments" => {
gix-status/src/stack.rs+4−4
@@ -1,10 +1,10 @@
1use crate::SymlinkCheck;
1use bstr::BStr;2use bstr::BStr;
3use gix_fs::stack::ToNormalPathComponents;
2use gix_fs::Stack;4use gix_fs::Stack;
3use std::borrow::Cow;5use std::borrow::Cow;
4use std::path::{Path, PathBuf};6use std::path::{Path, PathBuf};
5 7
6use crate::SymlinkCheck;
7
8impl SymlinkCheck {8impl SymlinkCheck {
9 /// Create a new stack that starts operating at `root`.9 /// Create a new stack that starts operating at `root`.
10 pub fn new(root: PathBuf) -> Self {10 pub fn new(root: PathBuf) -> Self {
@@ -24,7 +24,7 @@ impl SymlinkCheck { · 13 unmodified lines
24 /// ### Note24 /// ### Note
25 ///25 ///
26 /// On windows, no verification is performed, instead only the combined path is provided as usual.26 /// On windows, no verification is performed, instead only the combined path is provided as usual.
27 pub fn verified_path(&mut self, relative_path: &Path) -> std::io::Result<&Path> {27 pub fn verified_path(&mut self, relative_path: impl ToNormalPathComponents) -> std::io::Result<&Path> {
28 self.inner.make_relative_path_current(relative_path, &mut Delegate)?;28 self.inner.make_relative_path_current(relative_path, &mut Delegate)?;
29 Ok(self.inner.current())29 Ok(self.inner.current())
30 }30 }
@@ -34,7 +34,7 @@ impl SymlinkCheck { · 3 unmodified lines
34 /// For convenience, this incarnation is tuned to be easy to use with Git paths, i.e. slash-separated `BString` path.34 /// For convenience, this incarnation is tuned to be easy to use with Git paths, i.e. slash-separated `BString` path.
35 pub fn verified_path_allow_nonexisting(&mut self, relative_path: &BStr) -> std::io::Result<Cow<'_, Path>> {35 pub fn verified_path_allow_nonexisting(&mut self, relative_path: &BStr) -> std::io::Result<Cow<'_, Path>> {
36 let rela_path = gix_path::try_from_bstr(relative_path).map_err(std::io::Error::other)?;36 let rela_path = gix_path::try_from_bstr(relative_path).map_err(std::io::Error::other)?;
37 if let Err(err) = self.verified_path(&rela_path) {37 if let Err(err) = self.verified_path(rela_path.as_ref()) {
38 if err.kind() == std::io::ErrorKind::NotFound {38 if err.kind() == std::io::ErrorKind::NotFound {
39 Ok(Cow::Owned(self.inner.root().join(rela_path)))39 Ok(Cow::Owned(self.inner.root().join(rela_path)))
40 } else {40 } else {
gix-status/tests/status/stack.rs+6−12
@@ -25,7 +25,7 @@ fn paths_not_going_through_symlink_directories_are_ok_and_point_to_correct_item( · 24 unmodified lines
25 ("dir/dirlink", is_symlinked_dir),25 ("dir/dirlink", is_symlinked_dir),
26 ] {26 ] {
27 assert!(27 assert!(
28 expectation(&stack.verified_path(rela_path.as_ref())?.symlink_metadata()?),28 expectation(&stack.verified_path(rela_path)?.symlink_metadata()?),
29 "{rela_path:?} expectation failed"29 "{rela_path:?} expectation failed"
30 );30 );
31 }31 }
@@ -35,7 +35,7 @@ fn paths_not_going_through_symlink_directories_are_ok_and_point_to_correct_item( · 3 unmodified lines
35 35
36#[test]36#[test]
37fn leaf_file_does_not_have_to_exist() -> crate::Result {37fn leaf_file_does_not_have_to_exist() -> crate::Result {
38 assert!(!stack().verified_path("dir/does-not-exist".as_ref())?.exists());38 assert!(!stack().verified_path("dir/does-not-exist")?.exists());
39 Ok(())39 Ok(())
40}40}
41 41
@@ -43,10 +43,7 @@ fn leaf_file_does_not_have_to_exist() -> crate::Result { · 1 unmodified line
43#[cfg(not(windows))]43#[cfg(not(windows))]
44fn intermediate_directories_have_to_exist_or_not_found_error() -> crate::Result {44fn intermediate_directories_have_to_exist_or_not_found_error() -> crate::Result {
45 assert_eq!(45 assert_eq!(
46 stack()46 stack().verified_path("nonexisting-dir/file").unwrap_err().kind(),
47 .verified_path("nonexisting-dir/file".as_ref())
48 .unwrap_err()
49 .kind(),
50 std::io::ErrorKind::NotFound47 std::io::ErrorKind::NotFound
51 );48 );
52 Ok(())49 Ok(())
@@ -55,7 +52,7 @@ fn intermediate_directories_have_to_exist_or_not_found_error() -> crate::Result · 2 unmodified lines
55#[test]52#[test]
56#[cfg(windows)]53#[cfg(windows)]
57fn intermediate_directories_do_not_have_exist_for_success() -> crate::Result {54fn intermediate_directories_do_not_have_exist_for_success() -> crate::Result {
58 assert!(stack().verified_path("nonexisting-dir/file".as_ref()).is_ok());55 assert!(stack().verified_path("nonexisting-dir/file").is_ok());
59 Ok(())56 Ok(())
60}57}
61 58
@@ -67,16 +64,13 @@ fn intermediate_directories_do_not_have_exist_for_success() -> crate::Result { · 5 unmodified lines
67fn paths_leading_through_symlinks_are_rejected() {64fn paths_leading_through_symlinks_are_rejected() {
68 let mut stack = stack();65 let mut stack = stack();
69 assert_eq!(66 assert_eq!(
70 stack67 stack.verified_path("root-dirlink/file-in-dir").unwrap_err().kind(),
71 .verified_path("root-dirlink/file-in-dir".as_ref())
72 .unwrap_err()
73 .kind(),
74 std::io::ErrorKind::Other,68 std::io::ErrorKind::Other,
75 "root-dirlink is a symlink to a directory"69 "root-dirlink is a symlink to a directory"
76 );70 );
77 71
78 assert_eq!(72 assert_eq!(
79 stack.verified_path("dir/dirlink/nothing".as_ref()).unwrap_err().kind(),73 stack.verified_path("dir/dirlink/nothing").unwrap_err().kind(),
80 std::io::ErrorKind::Other,74 std::io::ErrorKind::Other,
81 "root-dirlink is a symlink to a directory"75 "root-dirlink is a symlink to a directory"
82 );76 );
gix-worktree-state/src/checkout/entry.rs+1−1
@@ -80,7 +80,7 @@ where · 79 unmodified lines
80 let dest_relative = gix_path::try_from_bstr(entry_path).map_err(|_| crate::checkout::Error::IllformedUtf8 {80 let dest_relative = gix_path::try_from_bstr(entry_path).map_err(|_| crate::checkout::Error::IllformedUtf8 {
81 path: entry_path.to_owned(),81 path: entry_path.to_owned(),
82 })?;82 })?;
83 let path_cache = path_cache.at_path(dest_relative, Some(entry.mode), &*objects)?;83 let path_cache = path_cache.at_path(dest_relative.as_ref(), Some(entry.mode), &*objects)?;
84 let dest = path_cache.path();84 let dest = path_cache.path();
85 85
86 let object_size = match entry.mode {86 let object_size = match entry.mode {
gix-worktree/Cargo.toml+1−1
@@ -9,7 +9,7 @@ description = "A crate of the gitoxide project for shared worktree related types · 8 unmodified lines
9authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]9authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
10edition = "2021"10edition = "2021"
11include = ["src/**/*", "LICENSE-*"]11include = ["src/**/*", "LICENSE-*"]
12rust-version = "1.70"12rust-version = "1.74"
13autotests = false13autotests = false
14 14
15[lib]15[lib]
gix-worktree/src/stack/mod.rs+4−11
@@ -113,7 +113,7 @@ impl Stack { · 112 unmodified lines
113 /// Provide access to cached information for that `relative` path via the returned platform.113 /// Provide access to cached information for that `relative` path via the returned platform.
114 pub fn at_path(114 pub fn at_path(
115 &mut self,115 &mut self,
116 relative: impl AsRef<Path>,116 relative: impl ToNormalPathComponents,
117 mode: Option<gix_index::entry::Mode>,117 mode: Option<gix_index::entry::Mode>,
118 objects: &dyn gix_object::Find,118 objects: &dyn gix_object::Find,
119 ) -> std::io::Result<Platform<'_>> {119 ) -> std::io::Result<Platform<'_>> {
@@ -127,8 +127,7 @@ impl Stack { · 7 unmodified lines
127 case: self.case,127 case: self.case,
128 statistics: &mut self.statistics,128 statistics: &mut self.statistics,
129 };129 };
130 self.stack130 self.stack.make_relative_path_current(relative, &mut delegate)?;
131 .make_relative_path_current(relative.as_ref(), &mut delegate)?;
132 Ok(Platform {131 Ok(Platform {
133 parent: self,132 parent: self,
134 is_dir: mode_is_dir(mode),133 is_dir: mode_is_dir(mode),
@@ -148,15 +147,8 @@ impl Stack { · 13 unmodified lines
148 objects: &dyn gix_object::Find,147 objects: &dyn gix_object::Find,
149 ) -> std::io::Result<Platform<'_>> {148 ) -> std::io::Result<Platform<'_>> {
150 let relative = relative.into();149 let relative = relative.into();
151 let relative_path = gix_path::try_from_bstr(relative).map_err(|_err| {
152 std::io::Error::new(
153 std::io::ErrorKind::Other,
154 format!("The path \"{relative}\" contained invalid UTF-8 and could not be turned into a path"),
155 )
156 })?;
157
158 self.at_path(150 self.at_path(
159 relative_path,151 relative,
160 mode.or_else(|| relative.ends_with_str("/").then_some(gix_index::entry::Mode::DIR)),152 mode.or_else(|| relative.ends_with_str("/").then_some(gix_index::entry::Mode::DIR)),
161 objects,153 objects,
162 )154 )
@@ -210,6 +202,7 @@ impl Stack { · 47 unmodified lines
210///202///
211pub mod delegate;203pub mod delegate;
212use delegate::StackDelegate;204use delegate::StackDelegate;
205use gix_fs::stack::ToNormalPathComponents;
213 206
214mod platform;207mod platform;
215///208///
gix-worktree/tests/worktree/stack/create_directory.rs+4−2
@@ -92,7 +92,7 @@ fn symlinks_or_files_in_path_are_forbidden_or_unlinked_when_forced() -> crate::R · 91 unmodified lines
92 let relative_path = format!("{dirname}/file");92 let relative_path = format!("{dirname}/file");
93 assert_eq!(93 assert_eq!(
94 cache94 cache
95 .at_path(&relative_path, IS_FILE, &gix_object::find::Never)95 .at_path(&*relative_path, IS_FILE, &gix_object::find::Never)
96 .unwrap_err()96 .unwrap_err()
97 .kind(),97 .kind(),
98 std::io::ErrorKind::AlreadyExists98 std::io::ErrorKind::AlreadyExists
@@ -112,7 +112,9 @@ fn symlinks_or_files_in_path_are_forbidden_or_unlinked_when_forced() -> crate::R · 13 unmodified lines
112 *unlink_on_collision = true;112 *unlink_on_collision = true;
113 }113 }
114 let relative_path = format!("{dirname}/file");114 let relative_path = format!("{dirname}/file");
115 let path = cache.at_path(&relative_path, IS_FILE, &gix_object::find::Never)?.path();115 let path = cache
116 .at_path(&*relative_path, IS_FILE, &gix_object::find::Never)?
117 .path();
116 assert!(path.parent().unwrap().is_dir(), "directory was forcefully created");118 assert!(path.parent().unwrap().is_dir(), "directory was forcefully created");
117 assert!(!path.exists());119 assert!(!path.exists());
118 }120 }
gix-worktree/tests/worktree/stack/ignore.rs+6−3
@@ -1,10 +1,10 @@
1use crate::{hex_to_id, worktree::stack::probe_case};
1use bstr::{BStr, ByteSlice};2use bstr::{BStr, ByteSlice};
3use gix_fs::stack::ToNormalPathComponents;
2use gix_index::entry::Mode;4use gix_index::entry::Mode;
3use gix_worktree::{stack::state::ignore::Source, Stack};5use gix_worktree::{stack::state::ignore::Source, Stack};
4use std::fs::Metadata;6use std::fs::Metadata;
5 7
6use crate::{hex_to_id, worktree::stack::probe_case};
7
8struct IgnoreExpectations<'a> {8struct IgnoreExpectations<'a> {
9 lines: bstr::Lines<'a>,9 lines: bstr::Lines<'a>,
10}10}
@@ -170,7 +170,10 @@ fn check_against_baseline() -> crate::Result { · 159 unmodified lines
170 // OK: we provide negative patterns that matched on paths if there was no other match, while git doesn't.170 // OK: we provide negative patterns that matched on paths if there was no other match, while git doesn't.
171 }171 }
172 (actual, expected) => {172 (actual, expected) => {
173 panic!("actual {actual:?} didn't match {expected:?} at '{relative_entry}'");173 panic!(
174 "actual {actual:?} didn't match {expected:?} at '{relative_entry}': {components:?}",
175 components = relative_entry.to_normal_path_components().collect::<Vec<_>>()
176 );
174 }177 }
175 }178 }
176 }179 }
gix/Cargo.toml+1−1
@@ -9,7 +9,7 @@ version = "0.70.0" · 8 unmodified lines
9authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]9authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
10edition = "2021"10edition = "2021"
11include = ["src/**/*", "LICENSE-*"]11include = ["src/**/*", "LICENSE-*"]
12rust-version = "1.70"12rust-version = "1.75"
13 13
14[lib]14[lib]
15doctest = false15doctest = false
gix/src/attribute_stack.rs+6−6
@@ -1,7 +1,7 @@
1use crate::{types::AttributeStack, Repository};
2use gix_fs::stack::ToNormalPathComponents;
1use std::ops::{Deref, DerefMut};3use std::ops::{Deref, DerefMut};
2 4
3use crate::{bstr::BStr, types::AttributeStack, Repository};
4
5/// Lifecycle5/// Lifecycle
6impl<'repo> AttributeStack<'repo> {6impl<'repo> AttributeStack<'repo> {
7 /// Create a new instance from a `repo` and the underlying pre-configured `stack`.7 /// Create a new instance from a `repo` and the underlying pre-configured `stack`.
@@ -44,18 +44,18 @@ impl AttributeStack<'_> { · 36 unmodified lines
44 relative: impl AsRef<std::path::Path>,44 relative: impl AsRef<std::path::Path>,
45 mode: Option<gix_index::entry::Mode>,45 mode: Option<gix_index::entry::Mode>,
46 ) -> std::io::Result<gix_worktree::stack::Platform<'_>> {46 ) -> std::io::Result<gix_worktree::stack::Platform<'_>> {
47 self.inner.at_path(relative, mode, &self.repo.objects)47 self.inner.at_path(relative.as_ref(), mode, &self.repo.objects)
48 }48 }
49 49
50 /// Obtain a platform for attribute or ignore lookups from a repo-`relative` path, typically obtained from an index entry.50 /// Obtain a platform for attribute or ignore lookups from a repo-`relative` path, typically obtained from an index entry.
51 /// `mode` should reflect whether it's a directory or not, or left at `None` if unknown.51 /// `mode` should reflect whether it's a directory or not, or left at `None` if unknown.
52 ///52 ///
53 /// If `relative` ends with `/` and `mode` is `None`, it is automatically assumed to be a directory.53 /// If `relative` ends with `/` and `mode` is `None`, it is automatically assumed to be a directory.
54 pub fn at_entry<'r>(54 pub fn at_entry(
55 &mut self,55 &mut self,
56 relative: impl Into<&'r BStr>,56 relative: impl ToNormalPathComponents,
57 mode: Option<gix_index::entry::Mode>,57 mode: Option<gix_index::entry::Mode>,
58 ) -> std::io::Result<gix_worktree::stack::Platform<'_>> {58 ) -> std::io::Result<gix_worktree::stack::Platform<'_>> {
59 self.inner.at_entry(relative, mode, &self.repo.objects)59 self.inner.at_path(relative, mode, &self.repo.objects)
60 }60 }
61}61}
gix/src/id.rs+1−1
@@ -64,7 +64,7 @@ impl<'repo> Id<'repo> { · 63 unmodified lines
64 64
65fn calculate_auto_hex_len(num_packed_objects: u64) -> usize {65fn calculate_auto_hex_len(num_packed_objects: u64) -> usize {
66 let mut len = 64 - num_packed_objects.leading_zeros();66 let mut len = 64 - num_packed_objects.leading_zeros();
67 len = (len + 1) / 2;67 len = len.div_ceil(2);
68 len.max(7) as usize68 len.max(7) as usize
69}69}
70 70
tests/it/src/commands/copy_royal.rs+1−1
@@ -29,7 +29,7 @@ pub(super) mod function { · 28 unmodified lines
29 {29 {
30 let rela_path = gix::path::from_bstr(rela_path);30 let rela_path = gix::path::from_bstr(rela_path);
31 let src = worktree_dir.join(&rela_path);31 let src = worktree_dir.join(&rela_path);
32 stack.make_relative_path_current(&rela_path, &mut create_dir)?;32 stack.make_relative_path_current(&*rela_path, &mut create_dir)?;
33 let dst = stack.current();33 let dst = stack.current();
34 34
35 eprintln!(35 eprintln!(

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t