From c63acd816741ce0e1b5595726242ab13d06b086e Mon Sep 17 00:00:00 2001 From: Hsiao-nan Cheung Date: Thu, 21 Apr 2022 21:31:26 +0800 Subject: [PATCH] Test `git` for safety Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com> --- bin/scoop.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/scoop.ps1 b/bin/scoop.ps1 index c7d24ae448..b4b8e1c77f 100644 --- a/bin/scoop.ps1 +++ b/bin/scoop.ps1 @@ -35,7 +35,7 @@ switch ($SubCommand) { Get-LocalBucket | ForEach-Object { $bucketLoc = Find-BucketDirectory $_ -Root - if (Test-Path (Join-Path $bucketLoc '.git')) { + if ((Test-Path (Join-Path $bucketLoc '.git')) -and (Test-CommandAvailable git)) { Write-Host "'$_' bucket:" Invoke-Expression "git -C '$bucketLoc' --no-pager log --oneline HEAD -n 1" Write-Host ''