Merge pull request #4162 from gitbutlerapp/better-exe-resolution

Use `gitoxide` to more reliably find the Git executable on Windows. (#1419)
This commit is contained in:
Kiril Videlov 2024-06-24 16:26:07 +02:00 committed by GitHub
commit b6c41e572f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 14 deletions

5
Cargo.lock generated
View File

@ -2166,6 +2166,7 @@ name = "gitbutler-git"
version = "0.0.0"
dependencies = [
"futures",
"gix-path",
"nix 0.29.0",
"rand 0.8.5",
"serde",
@ -2699,9 +2700,9 @@ dependencies = [
[[package]]
name = "gix-path"
version = "0.10.7"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23623cf0f475691a6d943f898c4d0b89f5c1a2a64d0f92bce0e0322ee6528783"
checksum = "ca987128ffb056d732bd545db5db3d8b103d252fbf083c2567bb0796876619a4"
dependencies = [
"bstr",
"gix-trace",

View File

@ -39,6 +39,7 @@ uuid = { workspace = true, features = ["v4", "fast-rng"] }
rand = "0.8.5"
futures = "0.3.30"
sysinfo = "0.30.12"
gix-path = "0.10.7"
[target."cfg(unix)".dependencies]
nix = { version = "0.29.0", features = ["process", "socket", "user"] }

View File

@ -28,17 +28,7 @@ unsafe impl super::GitExecutor for TokioExecutor {
cwd: P,
envs: Option<HashMap<String, String>>,
) -> Result<(usize, String, String), Self::Error> {
let git_exe = {
#[cfg(unix)]
{
"git"
}
#[cfg(windows)]
{
"git.exe"
}
};
let git_exe = gix_path::env::exe_invocation();
let mut cmd = Command::new(git_exe);
// Output the command being executed to stderr, for debugging purposes
@ -56,7 +46,7 @@ unsafe impl super::GitExecutor for TokioExecutor {
.map(|s| format!("{s:?}"))
.collect::<Vec<_>>()
.join(" ");
eprintln!("env {envs_str} {git_exe} {args_str}");
eprintln!("env {envs_str} {git_exe:?} {args_str}");
}
cmd.kill_on_drop(true);