Skip to content

Commit

Permalink
Compare minor versions only
Browse files Browse the repository at this point in the history
Explained by @borsboom at #4729 (review)
  • Loading branch information
snoyberg committed Apr 16, 2019
1 parent 56c2cea commit 191301a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Stack/Runners.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ module Stack.Runners
) where

import Stack.Prelude
import Distribution.Version (mkVersion')
import qualified Paths_stack
import RIO.Process (mkDefaultProcessContext)
import RIO.Time (addUTCTime, getCurrentTime)
import Stack.Build.Target(NeedTargets(..))
Expand All @@ -35,6 +33,7 @@ import Stack.Storage (upgradeChecksSince, logUpgradeCheck)
import Stack.Types.Config
import Stack.Types.Docker (dockerEnable)
import Stack.Types.Nix (nixEnable)
import Stack.Types.Version (stackMinorVersion, stackVersion, minorVersion)
import System.Console.ANSI (hSupportsANSIWithoutEmulation)
import System.Terminal (getTerminalWidth)

Expand Down Expand Up @@ -189,11 +188,13 @@ shouldUpgradeCheck = do
when (checks == 0) $ do
mversion <- getLatestHackageVersion NoRequireHackageIndex "stack" UsePreferredVersions
case mversion of
Just (PackageIdentifierRevision _ version _) | version > mkVersion' Paths_stack.version -> do
-- Compare the minor version so we avoid patch-level, Hackage-only releases.
-- See: https://github.com/commercialhaskell/stack/pull/4729#pullrequestreview-227176315
Just (PackageIdentifierRevision _ version _) | minorVersion version > stackMinorVersion -> do
logWarn "<<<<<<<<<<<<<<<<<<"
logWarn $
"You are currently using Stack version " <>
fromString (versionString (mkVersion' Paths_stack.version)) <>
fromString (versionString stackVersion) <>
", but version " <>
fromString (versionString version) <>
" is available"
Expand Down

0 comments on commit 191301a

Please sign in to comment.