Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- **installed:** Fix 'core/installed' that mark failed app as 'installed' ([#4650](https://github.com/ScoopInstaller/Scoop/issues/4650))
- **shim:** Fix PS1 shim error when in different drive in PS7 ([#4614](https://github.com/ScoopInstaller/Scoop/issues/4614))
- **shim:** Fix `sh` shim error in WSL ([#4637](https://github.com/ScoopInstaller/Scoop/issues/4637))
- **scoop-update:** Skip updating non git buckets ([#4670](https://github.com/ScoopInstaller/Scoop/issues/4670))

### Code Refactoring

Expand Down
36 changes: 23 additions & 13 deletions libexec/scoop-update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -123,32 +123,42 @@ function update_scoop() {
}
}

if ((Get-LocalBucket) -notcontains 'main') {
info "The main bucket of Scoop has been separated to 'https://github.com/ScoopInstaller/Main'"
info "Adding main bucket..."
add_bucket 'main'
}
# This should have been deprecated after 2019-05-12
# if ((Get-LocalBucket) -notcontains 'main') {
# info "The main bucket of Scoop has been separated to 'https://github.com/ScoopInstaller/Main'"
# info "Adding main bucket..."
# add_bucket 'main'
# }

ensure_scoop_in_path
shim "$currentdir\bin\scoop.ps1" $false

Get-LocalBucket | ForEach-Object {
write-host "Updating '$_' bucket..."
foreach ($bucket in Get-LocalBucket) {
Write-Host "Updating '$bucket' bucket..." -NoNewline
Comment thread
niheaven marked this conversation as resolved.

$bucketLoc = Find-BucketDirectory $bucket -Root

$loc = Find-BucketDirectory $_ -Root
# Make sure main bucket, which was downloaded as zip, will be properly "converted" into git
if (($_ -eq 'main') -and !(Test-Path "$loc\.git")) {
rm_bucket 'main'
add_bucket 'main'
if (!(Test-Path (Join-Path $bucketLoc '.git'))) {
if ($bucket -eq 'main') {
# Make sure main bucket, which was downloaded as zip, will be properly "converted" into git
Write-Host " Converting 'main' bucket to git..." -NoNewline
rm_bucket 'main'
add_bucket 'main'
Write-Host ' Done.'
} else {
Write-Host ' Not a git repository. Skipped.'
}
continue
}

Push-Location $loc
Push-Location $bucketLoc
$previousCommit = (Invoke-Expression 'git rev-parse HEAD')
git_pull -q
if ($show_update_log) {
Invoke-Expression "git --no-pager log --no-decorate --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset' '$previousCommit..HEAD'"
Comment thread
niheaven marked this conversation as resolved.
Outdated
}
Pop-Location
Write-Host ' Done.'
Comment thread
rashil2000 marked this conversation as resolved.
}

set_config lastupdate ([System.DateTime]::Now.ToString('o')) | Out-Null
Expand Down