Skip to content

Commit

Permalink
Merge pull request #2464 from commercialhaskell/2175-dont-truncate-repo
Browse files Browse the repository at this point in the history
Stop truncating all-cabal-hashes repo (#2175)
  • Loading branch information
Blaisorblade authored Aug 13, 2016
2 parents 54f59bd + 753a7db commit 54368c1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Stack/PackageIndex.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import Data.Text.Unsafe (unsafeTail)
import Data.Traversable (forM)
import Data.Typeable (Typeable)
import Network.HTTP.Download
import Path (mkRelDir, parent, parseRelDir, toFilePath, parseAbsFile, (</>))
import Path (mkRelDir, mkRelFile, parent, parseRelDir, toFilePath, parseAbsFile, (</>))
import Path.IO
import Prelude -- Fix AMP warning
import Stack.Types.Config
Expand Down Expand Up @@ -239,8 +239,6 @@ updateIndexGit menv indexName' index gitUrl = do
["clone"
,T.unpack gitUrl
,toFilePath repoName
,"--depth"
,"1"
,"-b" --
,"display"]
sDir <- configPackageIndexRoot indexName'
Expand All @@ -251,9 +249,13 @@ updateIndexGit menv indexName' index gitUrl = do
repoExists <- doesDirExist acfDir
unless repoExists
(readProcessNull (Just suDir) menv "git" cloneArgs)
isShallow <- doesFileExist $ acfDir </> $(mkRelDir ".git") </> $(mkRelFile "shallow")
when isShallow $ do
$logWarn "Shallow package index repo detected, transitioning to a full clone..."
(readProcessNull (Just acfDir) menv "git" ["fetch", "--unshallow"])
$logSticky "Fetching package index ..."
let runFetch = callProcessInheritStderrStdout
(Cmd (Just acfDir) "git" menv ["fetch","--tags","--depth=1"])
(Cmd (Just acfDir) "git" menv ["fetch","--tags"])
runFetch `C.catch` \(ex :: ProcessExitedUnsuccessfully) -> do
-- we failed, so wipe the directory and try again, see #1418
$logWarn (T.pack (show ex))
Expand Down

0 comments on commit 54368c1

Please sign in to comment.