Skip to content

Commit

Permalink
Use shorter hash for downloaded git repos #1620
Browse files Browse the repository at this point in the history
Makes it consistent with snapshot hashes, and potentially reduces
windows MAX_PATH problems
  • Loading branch information
mgsloan committed May 13, 2016
1 parent 08beb8e commit 452eacd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import Control.Monad.Trans.Control (MonadBaseControl)
import qualified Crypto.Hash.SHA256 as SHA256
import Data.Aeson.Extended
import qualified Data.ByteString as S
import qualified Data.ByteString.Base16 as B16
import qualified Data.ByteString.Base64.URL as B64URL
import qualified Data.ByteString.Lazy as L
import Data.Foldable (forM_)
import qualified Data.IntMap as IntMap
Expand Down Expand Up @@ -584,7 +584,8 @@ resolvePackageLocation menv projRoot (PLRemote url remotePackageType) = do
RPTHttp -> url
RPTGit commit -> url
RPTHg commit -> T.unwords [url, "hg"]
name = T.unpack $ decodeUtf8 $ B16.encode $ SHA256.hash $ encodeUtf8 nameBeforeHashing
-- TODO: dedupe with code for snapshot hash?
name = T.unpack $ decodeUtf8 $ S.take 12 $ B64URL.encode $ SHA256.hash $ encodeUtf8 nameBeforeHashing
root = projRoot </> workDir </> $(mkRelDir "downloaded")
fileExtension = case remotePackageType of
RPTHttp -> ".http-archive"
Expand Down

0 comments on commit 452eacd

Please sign in to comment.