Skip to content

Commit 5b4a3d4

Browse files
committed
Fix cloning per subdirectory wrt #5411
1 parent 708b516 commit 5b4a3d4

File tree

8 files changed

+21
-14
lines changed

8 files changed

+21
-14
lines changed

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Major changes:
1111

1212
Behavior changes:
1313

14+
* cloning git repositories isn't per sub-directory anymore, see [#5411](https://github.com/commercialhaskell/stack/issues/5411)
15+
1416
Other enhancements:
1517

1618
* `stack setup` supports installing GHC for macOS aarch64 (M1)

package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ dependencies:
9292
- network-uri
9393
- open-browser
9494
- optparse-applicative >= 0.14.3.0
95-
- pantry >= 0.5.2
95+
- pantry >= 0.5.3
9696
- casa-client
9797
- casa-types
9898
- path

src/Stack/Config.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
{-# LANGUAGE OverloadedStrings #-}
77
{-# LANGUAGE RecordWildCards #-}
88
{-# LANGUAGE TypeFamilies #-}
9+
{-# LANGUAGE LambdaCase #-}
910

1011
-- | The general Stack configuration that starts everything off. This should
1112
-- be smart to falback if there is no stack.yaml, instead relying on
@@ -652,6 +653,14 @@ fillProjectWanted stackYamlFP config project locCache snapCompiler snapPackages
652653
pp <- mkProjectPackage YesPrintWarnings resolved (boptsHaddock bopts)
653654
pure (cpName $ ppCommon pp, pp)
654655

656+
-- prefetch git repos to avoid cloning per subdirectory
657+
-- see https://github.com/commercialhaskell/stack/issues/5411
658+
let gitRepos = mapMaybe (\case
659+
(RPLImmutable (RPLIRepo repo rpm)) -> Just (repo, rpm)
660+
_ -> Nothing) (projectDependencies project)
661+
logDebug ("Prefetching git repos: " <> display (T.pack (show gitRepos)))
662+
fetchReposRaw gitRepos
663+
655664
(deps0, mcompleted) <- fmap unzip . forM (projectDependencies project) $ \rpl -> do
656665
(pl, mCompleted) <- case rpl of
657666
RPLImmutable rpli -> do

src/Stack/Setup.hs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -836,15 +836,8 @@ buildGhcFromSource getSetupInfo' installed (CompilerRepository url) commitId fla
836836
if compilerTool `elem` installed
837837
then return (compilerTool,CompilerBuildStandard)
838838
else do
839-
let repo = Repo
840-
{ repoCommit = commitId
841-
, repoUrl = url
842-
, repoType = RepoGit
843-
, repoSubdir = mempty
844-
}
845-
846839
-- clone the repository and execute the given commands
847-
Pantry.withRepo repo $ do
840+
Pantry.withRepo (Pantry.SimpleRepo url commitId RepoGit) $ do
848841
-- withRepo is guaranteed to set workingDirL, so let's get it
849842
mcwd <- traverse parseAbsDir =<< view workingDirL
850843
let cwd = fromMaybe (error "Invalid working directory") mcwd

stack-ghc-88.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ extra-deps:
3232
- casa-types-0.0.1@rev:0
3333
- rio-0.1.21.0@rev:0
3434
- rio-prettyprint-0.1.1.0@rev:0
35+
- pantry-0.5.3@rev:0
3536

3637
drop-packages:
3738
# See https://github.com/commercialhaskell/stack/pull/4712

stack-nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ghc-options:
2020
"$locals": -fhide-source-paths
2121

2222
extra-deps:
23-
- pantry-0.5.2@rev:0
23+
- pantry-0.5.3@rev:0
2424
- rio-0.1.21.0@rev:0
2525

2626
drop-packages:

stack.cabal

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ library
272272
, network-uri
273273
, open-browser
274274
, optparse-applicative >=0.14.3.0
275-
, pantry >=0.5.2
275+
, pantry >=0.5.3
276276
, path
277277
, path-io
278278
, persistent
@@ -395,7 +395,7 @@ executable stack
395395
, network-uri
396396
, open-browser
397397
, optparse-applicative >=0.14.3.0
398-
, pantry >=0.5.2
398+
, pantry >=0.5.3
399399
, path
400400
, path-io
401401
, persistent
@@ -517,7 +517,7 @@ executable stack-integration-test
517517
, open-browser
518518
, optparse-applicative >=0.14.3.0
519519
, optparse-generic
520-
, pantry >=0.5.2
520+
, pantry >=0.5.3
521521
, path
522522
, path-io
523523
, persistent
@@ -644,7 +644,7 @@ test-suite stack-test
644644
, network-uri
645645
, open-browser
646646
, optparse-applicative >=0.14.3.0
647-
, pantry >=0.5.2
647+
, pantry >=0.5.3
648648
, path
649649
, path-io
650650
, persistent

stack.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ packages:
55

66
extra-deps:
77
- rio-0.1.21.0@rev:0
8+
- pantry-0.5.3@rev:0
9+
810

911
docker:
1012
enable: false

0 commit comments

Comments
 (0)