That way it's easy to determine if a worktree root has any root set.
Unified · Split
| @@ -22,6 +22,7 @@ pub struct WorktreeRoots { · 21 unmodified lines | |||
| 22 | pub new_root: Option<PathBuf>, | 22 | pub new_root: Option<PathBuf>, |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | /// Access | ||
| 25 | impl WorktreeRoots { | 26 | impl WorktreeRoots { |
| 26 | /// Return the root path for the given `kind` | 27 | /// Return the root path for the given `kind` |
| 27 | pub fn by_kind(&self, kind: ResourceKind) -> Option<&Path> { | 28 | pub fn by_kind(&self, kind: ResourceKind) -> Option<&Path> { |
| @@ -30,6 +31,11 @@ impl WorktreeRoots { · 2 unmodified lines | |||
| 30 | ResourceKind::NewOrDestination => self.new_root.as_deref(), | 31 | ResourceKind::NewOrDestination => self.new_root.as_deref(), |
| 31 | } | 32 | } |
| 32 | } | 33 | } |
| 34 | |||
| 35 | /// Return `true` if all worktree roots are unset. | ||
| 36 | pub fn is_unset(&self) -> bool { | ||
| 37 | self.new_root.is_none() && self.old_root.is_none() | ||
| 38 | } | ||
| 33 | } | 39 | } |
| 34 | 40 | ||
| 35 | /// Data as part of an [Outcome]. | 41 | /// Data as part of an [Outcome]. |
| @@ -184,6 +190,8 @@ impl Pipeline { · 148 unmodified lines | |||
| 184 | /// Access | 190 | /// Access |
| 185 | impl Pipeline { | 191 | impl Pipeline { |
| 186 | /// Return all drivers that this instance was initialized with. | 192 | /// Return all drivers that this instance was initialized with. |
| 193 | /// | ||
| 194 | /// They are sorted by [`name`](Driver::name) to support binary searches. | ||
| 187 | pub fn drivers(&self) -> &[super::Driver] { | 195 | pub fn drivers(&self) -> &[super::Driver] { |
| 188 | &self.drivers | 196 | &self.drivers |
| 189 | } | 197 | } |
| @@ -445,7 +453,7 @@ impl Pipeline { · 255 unmodified lines | |||
| 445 | } | 453 | } |
| 446 | } | 454 | } |
| 447 | .map_err(|err| { | 455 | .map_err(|err| { |
| 448 | convert_to_diffable::Error::CreateTempfile { | 456 | convert_to_diffable::Error::StreamCopy { |
| 449 | source: err, | 457 | source: err, |
| 450 | rela_path: rela_path.to_owned(), | 458 | rela_path: rela_path.to_owned(), |
| 451 | } | 459 | } |
| @@ -533,6 +541,8 @@ impl Driver { · 81 unmodified lines | |||
| 533 | pub fn prepare_binary_to_text_cmd(&self, path: &Path) -> Option<std::process::Command> { | 541 | pub fn prepare_binary_to_text_cmd(&self, path: &Path) -> Option<std::process::Command> { |
| 534 | let command: &BStr = self.binary_to_text_command.as_ref()?.as_ref(); | 542 | let command: &BStr = self.binary_to_text_command.as_ref()?.as_ref(); |
| 535 | let cmd = gix_command::prepare(gix_path::from_bstr(command).into_owned()) | 543 | let cmd = gix_command::prepare(gix_path::from_bstr(command).into_owned()) |
| 544 | // TODO: Add support for an actual Context, validate it *can* match Git | ||
| 545 | .with_context(Default::default()) | ||
| 536 | .with_shell() | 546 | .with_shell() |
| 537 | .stdin(Stdio::null()) | 547 | .stdin(Stdio::null()) |
| 538 | .stdout(Stdio::piped()) | 548 | .stdout(Stdio::piped()) |
| @@ -184,7 +184,7 @@ pub mod prepare_diff { · 183 unmodified lines | |||
| 184 | 184 | ||
| 185 | use crate::blob::platform::Resource; | 185 | use crate::blob::platform::Resource; |
| 186 | 186 | ||
| 187 | /// The kind of operation that was performed during the [`diff`](super::Platform::prepare_diff()) operation. | 187 | /// The kind of operation that should be performed based on the configuration of the resources involved in the diff. |
| 188 | #[derive(Debug, Copy, Clone, Eq, PartialEq)] | 188 | #[derive(Debug, Copy, Clone, Eq, PartialEq)] |
| 189 | pub enum Operation<'a> { | 189 | pub enum Operation<'a> { |
| 190 | /// The [internal diff algorithm](imara_diff::diff) should be called with the provided arguments. | 190 | /// The [internal diff algorithm](imara_diff::diff) should be called with the provided arguments. |