diff --git a/gix-diff/src/blob/pipeline.rs b/gix-diff/src/blob/pipeline.rs index 45018218426..cdd886dcede 100644 --- a/gix-diff/src/blob/pipeline.rs +++ b/gix-diff/src/blob/pipeline.rs @@ -22,6 +22,7 @@ pub struct WorktreeRoots { pub new_root: Option, } +/// Access impl WorktreeRoots { /// Return the root path for the given `kind` pub fn by_kind(&self, kind: ResourceKind) -> Option<&Path> { @@ -30,6 +31,11 @@ impl WorktreeRoots { ResourceKind::NewOrDestination => self.new_root.as_deref(), } } + + /// Return `true` if all worktree roots are unset. + pub fn is_unset(&self) -> bool { + self.new_root.is_none() && self.old_root.is_none() + } } /// Data as part of an [Outcome]. @@ -184,6 +190,8 @@ impl Pipeline { /// Access impl Pipeline { /// Return all drivers that this instance was initialized with. + /// + /// They are sorted by [`name`](Driver::name) to support binary searches. pub fn drivers(&self) -> &[super::Driver] { &self.drivers } @@ -445,7 +453,7 @@ impl Pipeline { } } .map_err(|err| { - convert_to_diffable::Error::CreateTempfile { + convert_to_diffable::Error::StreamCopy { source: err, rela_path: rela_path.to_owned(), } @@ -533,6 +541,10 @@ impl Driver { pub fn prepare_binary_to_text_cmd(&self, path: &Path) -> Option { let command: &BStr = self.binary_to_text_command.as_ref()?.as_ref(); let cmd = gix_command::prepare(gix_path::from_bstr(command).into_owned()) + // This program intentionally doesn't get the whole Git context. + // In fact, when checked it only saw the `GIT_EXEC_PATH` and `COLORTERM` environment variables, nothing more. + // We by default let it inherit the entire environment. On Windows, Git seems to add the env though. + .with_context(Default::default()) .with_shell() .stdin(Stdio::null()) .stdout(Stdio::piped()) diff --git a/gix-diff/src/blob/platform.rs b/gix-diff/src/blob/platform.rs index 6a550bc2dcf..4c540cce85d 100644 --- a/gix-diff/src/blob/platform.rs +++ b/gix-diff/src/blob/platform.rs @@ -184,7 +184,7 @@ pub mod prepare_diff { use crate::blob::platform::Resource; - /// The kind of operation that was performed during the [`diff`](super::Platform::prepare_diff()) operation. + /// The kind of operation that should be performed based on the configuration of the resources involved in the diff. #[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum Operation<'a> { /// The [internal diff algorithm](imara_diff::diff) should be called with the provided arguments.