Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Check if buckets are outdated in scoop status #3550

Closed
wants to merge 3 commits into from

Conversation

nimzo6689
Copy link
Contributor

@nimzo6689 nimzo6689 commented Jul 8, 2019

@Ash258
Copy link
Contributor

Ash258 commented Jul 9, 2019

Duplicating code from update is not key.

completely easy, non resource consuming fix could look like this:,

Test-UpdateStatus {
	Get-LocalBucket | Foreach-Object {
		$loc = Find-BucketDirectory $_ -Root
		Push-Location $
		git_fetch -q 
		$status = (git_status) -like 'is behind'
		Pop-Location

		if ($status) { return $true }
	}
}

@nimzo6689
Copy link
Contributor Author

@Ash258
Thanks for the advice.
I've updated some codes for refactoring.

*In PowerShell, return in Foreach-Object behaves like the continue statement. (I missed it.)
So I replaced it with foreach statement for return early.

How about this?

libexec/scoop-status.ps1 Outdated Show resolved Hide resolved
if($needs_update) {
# check if scoop needs updating
$needs_update = !(Test-ScoopLatest)
if ($needs_update) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ($needs_update) {
if (!(Test-ScoopLatest)) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$needs_update is also used in L115.

libexec/scoop-status.ps1 Outdated Show resolved Hide resolved
@rasa rasa changed the title Fixes. #3549 Fixes #3549 Jul 19, 2019
@rashil2000 rashil2000 changed the title Fixes #3549 Check if buckets are outdated in scoop status Jan 8, 2022
@rashil2000
Copy link
Member

Superseded by #5011

@rashil2000 rashil2000 closed this Jun 21, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants