diff --git a/install.ps1 b/install.ps1 index fbd23b1..4c9ac12 100644 --- a/install.ps1 +++ b/install.ps1 @@ -416,13 +416,21 @@ function Install-FromSource { New-Item -ItemType Directory -Force -Path $parent | Out-Null if (Test-Path (Join-Path $sourceCache ".git")) { git -C $sourceCache remote set-url origin $Repo - git -C $sourceCache fetch --depth 1 origin main + $fetchArgs = @("-C", $sourceCache, "fetch", "--depth", "1", "origin", "main") + if ($Quiet) { + $fetchArgs = @("-C", $sourceCache, "fetch", "-q", "--depth", "1", "origin", "main") + } + git @fetchArgs git -C $sourceCache checkout -q -B main FETCH_HEAD } else { if (Test-Path $sourceCache) { Remove-Item -Recurse -Force $sourceCache } - git clone --depth 1 --branch main $Repo $sourceCache | Out-Null + $cloneArgs = @("clone", "--depth", "1", "--branch", "main", $Repo, $sourceCache) + if ($Quiet) { + $cloneArgs = @("clone", "-q", "--depth", "1", "--branch", "main", $Repo, $sourceCache) + } + git @cloneArgs | Out-Null } $src = $sourceCache } diff --git a/tests/release_scripts.rs b/tests/release_scripts.rs index 76173df..339d696 100644 --- a/tests/release_scripts.rs +++ b/tests/release_scripts.rs @@ -167,15 +167,34 @@ fn windows_installer_reuses_persistent_source_update_cache() { assert!(ps1.contains("Assert-NoRelativePathSegments $Path")); assert!(ps1.contains("$segment -eq \".\" -or $segment -eq \"..\"")); assert!(ps1.contains("$sourceCache = Assert-SafeUpdateCache $UpdateCache")); - assert!(ps1.contains("git -C $sourceCache fetch --depth 1 origin main")); + assert!(ps1.contains( + "$fetchArgs = @(\"-C\", $sourceCache, \"fetch\", \"--depth\", \"1\", \"origin\", \"main\")" + )); + assert!(ps1.contains("$fetchArgs = @(\"-C\", $sourceCache, \"fetch\", \"-q\", \"--depth\", \"1\", \"origin\", \"main\")")); + assert!(ps1.contains("git @fetchArgs")); assert!(ps1.contains("git -C $sourceCache checkout -q -B main FETCH_HEAD")); - assert!(ps1.contains("git clone --depth 1 --branch main $Repo $sourceCache")); + assert!(ps1.contains( + "$cloneArgs = @(\"clone\", \"--depth\", \"1\", \"--branch\", \"main\", $Repo, $sourceCache)" + )); + assert!(ps1.contains("$cloneArgs = @(\"clone\", \"-q\", \"--depth\", \"1\", \"--branch\", \"main\", $Repo, $sourceCache)")); + assert!(ps1.contains("git @cloneArgs | Out-Null")); assert!( !ps1.contains("git clone --depth 1 $Repo $tmp"), "Windows source updates should reuse a persistent cache instead of recloning into temp" ); } +#[test] +fn windows_quiet_source_updates_silence_git_like_unix() { + let install = include_str!("../install.sh"); + let ps1 = include_str!("../install.ps1"); + assert!(install.contains("git -C \"$update_cache\" fetch -q --depth 1 origin main")); + assert!(install.contains("git clone -q --depth 1 --branch main \"$repo\" \"$update_cache\"")); + assert!(ps1.contains("if ($Quiet)")); + assert!(ps1.contains("\"fetch\", \"-q\", \"--depth\"")); + assert!(ps1.contains("\"clone\", \"-q\", \"--depth\"")); +} + #[test] fn windows_installer_bootstraps_rust_for_source_fallback_like_unix() { let install = include_str!("../install.sh");