mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-12-07 16:45:34 +00:00
fix(scoop-bucket): Check for git before running command (#4756)
* fix(scoop-bucket): Check for git before running command * Apply suggestions from code review Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com> * Update CHANGELOG.md Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
- **scoop-checkup:** Skip 'check_windows_defender' when have not admin privileges ([#4699](https://github.com/ScoopInstaller/Scoop/issues/4699))
|
||||
- **scoop-cleanup:** Remove apps other than current version ([#4665](https://github.com/ScoopInstaller/Scoop/issues/4665))
|
||||
- **scoop-update:** Skip updating non git buckets ([#4670](https://github.com/ScoopInstaller/Scoop/issues/4670), [#4672](https://github.com/ScoopInstaller/Scoop/issues/4672))
|
||||
- **scoop-bucket:** Check for git before running command ([#4756](https://github.com/ScoopInstaller/Scoop/issues/4756))
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
|
||||
@@ -38,11 +38,11 @@ function list_buckets {
|
||||
Measure-Object | Select-Object -ExpandProperty Count
|
||||
)
|
||||
$updated = 'N/A'
|
||||
if (Test-Path (Join-Path $source '.git')) {
|
||||
$updated = git -C "`"$source`"" log --date=format:"`"%Y-%m-%d %H:%M:%S`"" --format='%ad' -n 1
|
||||
if ((Test-Path (Join-Path $source '.git')) -and (Get-Command git -ErrorAction SilentlyContinue)) {
|
||||
$updated = git -C "`"$source`"" log --date=format:"`"%d-%m-%Y %H:%M:%S`"" --format='%ad' -n 1 | Get-Date
|
||||
$source = git -C "`"$source`"" config remote.origin.url
|
||||
} else {
|
||||
$updated = (Get-Item "$source\bucket").LastWriteTime | Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
|
||||
$updated = (Get-Item "$source\bucket").LastWriteTime
|
||||
$source = friendly_path $source
|
||||
}
|
||||
$buckets += New-Object PSObject -Property @{
|
||||
|
||||
Reference in New Issue
Block a user