Skip to content

Commit

Permalink
Merge pull request #509 from noha/dev-0.6
Browse files Browse the repository at this point in the history
Move reference commit to head if no other commit between saved package commit and head commit changes a package.
  • Loading branch information
estebanlm authored Nov 10, 2017
2 parents fc9c3e0 + 7b3c9f8 commit 8664112
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 8664112

Please sign in to comment.