Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Move reference commit to head if no other commit between saved package commit and head commit changes a package. #509

Merged
merged 1 commit into from
Nov 10, 2017
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ computeReferenceCommit
"2. Happy path: see if all loaded code has the same updation commit.
If we can't compute an updation commit for some loaded code, it means that it has been
probably loaded from another kind of repository, we just ignore it."

candidates := (self loadedVersions collect: [:version | version commit] as: Set) reject: #isNil.
candidates size = 1 ifTrue: [ ^ candidates anyOne ].
candidates size = 1 ifTrue: [
"If there is no newer commit for this repository until the loaded one we use the
head commit instead. This covers the case where commits external to pharo happened
since last time the package was loaded"
^ (repository headCommit changedPackagesTo: candidates anyOne)
ifNotEmpty: [ candidates anyOne ]
ifEmpty: [ repository headCommit ] ].

"3. None of the loaded versions produced a non nil candidate, just use the HEAD commit"
candidates isEmpty ifTrue: [ ^ self repository headCommit ].
Expand Down