Skip to content

Commit f641aae

Browse files
authored
Merge pull request #163 from awvwgk/fetch
Use different strategy to fetch git dependencies
2 parents e6f8785 + 7bdde90 commit f641aae

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

bootstrap/src/Fpm.hs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -617,19 +617,23 @@ fetchDependency name version = do
617617
undefined
618618
GitVersion versionSpec -> do
619619
system
620-
("git clone " ++ gitVersionSpecUrl versionSpec ++ " " ++ clonePath)
620+
("git init " ++ clonePath)
621621
case gitVersionSpecRef versionSpec of
622-
Just ref -> withCurrentDirectory clonePath $ do
622+
Just ref -> do
623623
system
624-
( "git checkout "
624+
("git -C " ++ clonePath ++ " fetch " ++ gitVersionSpecUrl versionSpec ++ " "
625625
++ (case ref of
626626
Tag tag -> tag
627627
Branch branch -> branch
628628
Commit commit -> commit
629629
)
630630
)
631-
return (name, clonePath)
632-
Nothing -> return (name, clonePath)
631+
Nothing -> do
632+
system
633+
("git -C " ++ clonePath ++ " fetch " ++ gitVersionSpecUrl versionSpec)
634+
system
635+
("git -C " ++ clonePath ++ " checkout -qf FETCH_HEAD")
636+
return (name, clonePath)
633637
PathVersion versionSpec -> return (name, pathVersionSpecPath versionSpec)
634638

635639
{-

0 commit comments

Comments
 (0)