diff --git a/Cargo.lock b/Cargo.lock index 6433d14dea5..cd49b7230bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1401,6 +1401,7 @@ version = "0.2.10" dependencies = [ "bstr", "gix-testtools", + "gix-trace 0.1.3", ] [[package]] @@ -1480,6 +1481,7 @@ dependencies = [ "gix-prompt", "gix-sec 0.10.0", "gix-testtools", + "gix-trace 0.1.3", "gix-url", "serde", "thiserror", diff --git a/gix-command/Cargo.toml b/gix-command/Cargo.toml index d63c1ecb319..654011b8f68 100644 --- a/gix-command/Cargo.toml +++ b/gix-command/Cargo.toml @@ -13,6 +13,8 @@ include = ["src/lib.rs", "LICENSE-*"] doctest = false [dependencies] +gix-trace = { version = "^0.1.3", path = "../gix-trace" } + bstr = { version = "1.5.0", default-features = false, features = ["std"] } [dev-dependencies] diff --git a/gix-command/src/lib.rs b/gix-command/src/lib.rs index 9e662b016d2..29a58964a7e 100644 --- a/gix-command/src/lib.rs +++ b/gix-command/src/lib.rs @@ -93,7 +93,9 @@ mod prepare { impl Prepare { /// Spawn the command as configured. pub fn spawn(self) -> std::io::Result { - Command::from(self).spawn() + let mut cmd = Command::from(self); + gix_trace::debug!(cmd = ?cmd); + cmd.spawn() } } diff --git a/gix-credentials/Cargo.toml b/gix-credentials/Cargo.toml index 5b8843f3414..ceefa995efc 100644 --- a/gix-credentials/Cargo.toml +++ b/gix-credentials/Cargo.toml @@ -23,6 +23,7 @@ gix-path = { version = "^0.10.0", path = "../gix-path" } gix-command = { version = "^0.2.10", path = "../gix-command" } gix-config-value = { version = "^0.14.0", path = "../gix-config-value" } gix-prompt = { version = "^0.7.0", path = "../gix-prompt" } +gix-trace = { version = "^0.1.3", path = "../gix-trace" } thiserror = "1.0.32" serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"] } diff --git a/gix-credentials/src/program/mod.rs b/gix-credentials/src/program/mod.rs index 80146601856..66346d2b06a 100644 --- a/gix-credentials/src/program/mod.rs +++ b/gix-credentials/src/program/mod.rs @@ -106,6 +106,7 @@ impl Program { Stdio::null() }) .stderr(if self.stderr { Stdio::inherit() } else { Stdio::null() }); + gix_trace::debug!(cmd = ?cmd, "launching credential helper"); let mut child = cmd.spawn()?; let stdin = child.stdin.take().expect("stdin to be configured"); let stdout = child.stdout.take(); diff --git a/gix-path/src/env/git.rs b/gix-path/src/env/git.rs index b8a9bc0d59f..864a4d49aff 100644 --- a/gix-path/src/env/git.rs +++ b/gix-path/src/env/git.rs @@ -22,6 +22,7 @@ pub(crate) fn install_config_path() -> Option<&'static BStr> { cmd.args(["config", "-l", "--show-origin"]) .stdin(Stdio::null()) .stderr(Stdio::null()); + gix_trace::debug!(cmd = ?cmd, "invoking git for installation config path"); first_file_from_config_with_origin(cmd.output().ok()?.stdout.as_slice().into()).map(ToOwned::to_owned) }); PATH.as_ref().map(AsRef::as_ref) diff --git a/gix-path/src/env/mod.rs b/gix-path/src/env/mod.rs index 170222c7aff..ef9ccdf2e36 100644 --- a/gix-path/src/env/mod.rs +++ b/gix-path/src/env/mod.rs @@ -74,12 +74,10 @@ pub fn system_prefix() -> Option<&'static Path> { } } - let path = std::process::Command::new("git.exe") - .arg("--exec-path") - .stderr(std::process::Stdio::null()) - .output() - .ok()? - .stdout; + let mut cmd = std::process::Command::new("git.exe"); + cmd.arg("--exec-path").stderr(std::process::Stdio::null()); + gix_trace::debug!(cmd = ?cmd, "invoking git to get system prefix/exec path"); + let path = cmd.output().ok()?.stdout; let path = BString::new(path) .trim_with(|b| b.is_ascii_whitespace()) .to_path() diff --git a/gix-transport/src/client/blocking_io/ssh/mod.rs b/gix-transport/src/client/blocking_io/ssh/mod.rs index 4f89eaa66af..3d83493ca85 100644 --- a/gix-transport/src/client/blocking_io/ssh/mod.rs +++ b/gix-transport/src/client/blocking_io/ssh/mod.rs @@ -107,7 +107,7 @@ pub fn connect( let ssh_cmd = options.ssh_command(); let mut kind = options.kind.unwrap_or_else(|| ProgramKind::from(ssh_cmd)); if options.kind.is_none() && kind == ProgramKind::Simple { - kind = if std::process::Command::from( + let mut cmd = std::process::Command::from( gix_command::prepare(ssh_cmd) .stderr(Stdio::null()) .stdout(Stdio::null()) @@ -117,11 +117,9 @@ pub fn connect( .arg(url.host_argument_safe().ok_or_else(|| Error::AmbiguousHostName { host: url.host().expect("set in ssh urls").into(), })?), - ) - .status() - .ok() - .map_or(false, |status| status.success()) - { + ); + gix_features::trace::debug!(cmd = ?cmd, "invoking `ssh` for feature check"); + kind = if cmd.status().ok().map_or(false, |status| status.success()) { ProgramKind::Ssh } else { ProgramKind::Simple