diff --git a/Cargo.lock b/Cargo.lock index 9f82b1466..252a3e936 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2582,9 +2582,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 1.9.1", "gix-trace", @@ -4611,6 +4611,7 @@ dependencies = [ "fs_extra", "futures", "gix", + "gix-path", "glob", "ignore", "include_dir", diff --git a/Cargo.toml b/Cargo.toml index b146271ef..e4216790d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,6 +74,7 @@ fs4 = { version = "0.7", features = ["tokio"] } fs_extra = "1" futures = { version = "0.3", default-features = false, features = ["std", "async-await"] } gix = ">=0.55" +gix-path = "0.10" glob = "0.3" ignore = "0.4" include_dir = "0.7" diff --git a/scarb/Cargo.toml b/scarb/Cargo.toml index 2d0b37759..5673ab67e 100644 --- a/scarb/Cargo.toml +++ b/scarb/Cargo.toml @@ -44,6 +44,7 @@ dunce.workspace = true fs4.workspace = true futures.workspace = true gix.workspace = true +gix-path.workspace = true glob.workspace = true ignore.workspace = true include_dir.workspace = true diff --git a/scarb/src/sources/git/client.rs b/scarb/src/sources/git/client.rs index 5c460e90e..34b9ec882 100644 --- a/scarb/src/sources/git/client.rs +++ b/scarb/src/sources/git/client.rs @@ -399,7 +399,7 @@ impl PackageRepository { } fn git_command() -> Command { - let mut cmd = Command::new("git"); + let mut cmd = Command::new(gix_path::env::exe_invocation()); // If Scarb is run by Git (for example, the `exec` command in `git rebase`), // the GIT_DIR is set by Git and will point to the wrong location (this takes precedence diff --git a/scarb/tests/git_source.rs b/scarb/tests/git_source.rs index 3289339a0..0d61bc839 100644 --- a/scarb/tests/git_source.rs +++ b/scarb/tests/git_source.rs @@ -490,9 +490,9 @@ fn deps_only_cloned_to_checkouts_once() { .success() .stdout_matches(indoc! {r#" [..] Updating git repository file://[..]/dep1 - [..]Running git fetch --verbose --force --update-head-ok [..]dep1 +HEAD:refs/remotes/origin/HEAD - [..]Running git clone --local --verbose --config core.autocrlf=false --recurse-submodules [..].git [..] - [..]Running git reset --hard [..] + [..]Running git[EXE] fetch --verbose --force --update-head-ok [..]dep1 +HEAD:refs/remotes/origin/HEAD + [..]Running git[EXE] clone --local --verbose --config core.autocrlf=false --recurse-submodules [..].git [..] + [..]Running git[EXE] reset --hard [..] "#}); fs::remove_file(t.child("Scarb.lock")).unwrap(); Scarb::quick_snapbox() @@ -504,6 +504,6 @@ fn deps_only_cloned_to_checkouts_once() { .success() .stdout_matches(indoc! {r#" [..] Updating git repository file://[..]/dep1 - [..]Running git fetch --verbose --force --update-head-ok [..]dep1 +HEAD:refs/remotes/origin/HEAD + [..]Running git[EXE] fetch --verbose --force --update-head-ok [..]dep1 +HEAD:refs/remotes/origin/HEAD "#}); }