Skip to content

Commit 6f8bf04

Browse files
authored
fix(scoop-update): Skip updating non git buckets (#4670)
1 parent c9df8f4 commit 6f8bf04

2 files changed

Lines changed: 26 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- **installed:** Fix 'core/installed' that mark failed app as 'installed' ([#4650](https://github.com/ScoopInstaller/Scoop/issues/4650))
1818
- **shim:** Fix PS1 shim error when in different drive in PS7 ([#4614](https://github.com/ScoopInstaller/Scoop/issues/4614))
1919
- **shim:** Fix `sh` shim error in WSL ([#4637](https://github.com/ScoopInstaller/Scoop/issues/4637))
20+
- **scoop-update:** Skip updating non git buckets ([#4670](https://github.com/ScoopInstaller/Scoop/issues/4670))
2021

2122
### Code Refactoring
2223

libexec/scoop-update.ps1

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function update_scoop() {
114114

115115
$res = $lastexitcode
116116
if ($show_update_log) {
117-
Invoke-Expression "git --no-pager log --no-decorate --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset' '$previousCommit..HEAD'"
117+
Invoke-Expression "git --no-pager log --no-decorate --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset' '$previousCommit..HEAD'" | Where-Object { $_ -notlike '* ?chore*' }
118118
}
119119

120120
Pop-Location
@@ -123,32 +123,42 @@ function update_scoop() {
123123
}
124124
}
125125

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

132133
ensure_scoop_in_path
133134
shim "$currentdir\bin\scoop.ps1" $false
134135

135-
Get-LocalBucket | ForEach-Object {
136-
write-host "Updating '$_' bucket..."
136+
foreach ($bucket in Get-LocalBucket) {
137+
Write-Host "Updating '$bucket' bucket..." -NoNewline
138+
139+
$bucketLoc = Find-BucketDirectory $bucket -Root
137140

138-
$loc = Find-BucketDirectory $_ -Root
139-
# Make sure main bucket, which was downloaded as zip, will be properly "converted" into git
140-
if (($_ -eq 'main') -and !(Test-Path "$loc\.git")) {
141-
rm_bucket 'main'
142-
add_bucket 'main'
141+
if (!(Test-Path (Join-Path $bucketLoc '.git'))) {
142+
if ($bucket -eq 'main') {
143+
# Make sure main bucket, which was downloaded as zip, will be properly "converted" into git
144+
Write-Host " Converting 'main' bucket to git..." -NoNewline
145+
rm_bucket 'main'
146+
add_bucket 'main'
147+
Write-Host ' Done.'
148+
} else {
149+
Write-Host ' Not a git repository. Skipped.'
150+
}
151+
continue
143152
}
144153

145-
Push-Location $loc
154+
Push-Location $bucketLoc
146155
$previousCommit = (Invoke-Expression 'git rev-parse HEAD')
147156
git_pull -q
148157
if ($show_update_log) {
149-
Invoke-Expression "git --no-pager log --no-decorate --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset' '$previousCommit..HEAD'"
158+
Invoke-Expression "git --no-pager log --no-decorate --format='tformat: * %C(yellow)%h%Creset %<|(72,trunc)%s %C(cyan)%cr%Creset' '$previousCommit..HEAD'" | Where-Object { $_ -notlike '* ?chore*' }
150159
}
151160
Pop-Location
161+
Write-Host ' Done.'
152162
}
153163

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

0 commit comments

Comments
 (0)