From 4adafcd78bd8561efef0a5e0fb7f2a9252edd22c Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Wed, 1 May 2019 23:29:41 +0200 Subject: [PATCH] Fix updating for changing targets Branches like master would now work --- update.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/update.hs b/update.hs index 284f0c4..87efa6e 100755 --- a/update.hs +++ b/update.hs @@ -10,7 +10,7 @@ import Control.Exception (handleJust) import Control.Monad.Reader import Data.Aeson (decode) import qualified Data.ByteString.Lazy.Char8 as BS -import Data.Char (isDigit) +import Data.Char (isDigit, isHexDigit) import Data.List (intercalate) import Data.Maybe import Data.Time @@ -221,7 +221,7 @@ regenerate revision genDir = do hash <- revHash hie revision liftIO $ putStrLn $ "Writing " ++ revision ++ " to " ++ genDir ++ "/revision" liftIO $ writeFile (genDir "revision") revision - git hie [ "checkout", revision ] + git hie [ "checkout", if all isHexDigit revision then revision else "origin/" ++ revision ] files <- repoPath hie >>= liftIO . listDirectory let versions = mapMaybe (stackPathRegex `match`) files liftIO $ putStrLn $ "HIE " ++ revision ++ " has ghc versions " ++ intercalate ", " (map show versions)