@@ -491,9 +491,6 @@ vcsGit =
491
491
resetArgs tag = " reset" : verboseArg ++ [" --hard" , tag, " --" ]
492
492
verboseArg = [" --quiet" | verbosity < Verbosity. normal]
493
493
494
- -- Note: No --depth=1 for vcsCloneRepo since that is used for `cabal get -s`,
495
- -- whereas `vcsSyncRepo` is used for source-repository-package where we do want shallow clones.
496
-
497
494
vcsSyncRepos
498
495
:: Verbosity
499
496
-> ConfiguredProgram
@@ -546,44 +543,9 @@ vcsGit =
546
543
(\ e -> if isPermissionError e then removePathForcibly dotGitModulesPath else throw e)
547
544
else removeDirectoryRecursive dotGitModulesPath
548
545
549
- -- If we want a particular branch or tag, fetch it.
550
- ref <- case srpBranch `mplus` srpTag of
551
- Nothing -> pure " HEAD"
552
- Just ref -> do
553
- -- /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\
554
- -- /!\ MULTIPLE HOURS HAVE BEEN LOST HERE!! /!\
555
- -- /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\
556
- --
557
- -- If you run `git fetch origin MY_TAG`, then the tag _will_ be
558
- -- fetched, but no local ref (e.g. `refs/tags/MY_TAG`) will be
559
- -- created.
560
- --
561
- -- This means that doing `git fetch origin MY_TAG && git reset --hard
562
- -- MY_TAG` will fail with a message like `unknown revision MY_TAG`.
563
- --
564
- -- There are two ways around this:
565
- --
566
- -- 1. Provide a refmap explicitly:
567
- --
568
- -- git fetch --refmap="+refs/tags/*:refs/tags/*" origin MYTAG
569
- --
570
- -- This tells Git to create local tags matching remote tags. It's
571
- -- not in the default refmap so you need to set it explicitly.
572
- -- (You can also set it with `git config set --local
573
- -- remote.origin.fetch ...`.)
574
- --
575
- -- 2. Use `FETCH_HEAD` directly: Git writes a `FETCH_HEAD` ref
576
- -- containing the commit that was just fetched. This feels a bit
577
- -- nasty but seems to work reliably, even if nothing was fetched.
578
- -- (That is, deleting `FETCH_HEAD` and re-running a `git fetch`
579
- -- command will succesfully recreate the `FETCH_HEAD` ref.)
580
- --
581
- -- Option 2 is what Cabal has done historically, and we're keeping it
582
- -- for now. Option 1 is possible but seems to have little benefit.
583
- git localDir (" fetch" : verboseArg ++ [" origin" , ref])
584
- pure " FETCH_HEAD"
585
-
586
- -- Then, reset to the appropriate ref.
546
+ -- If we want a particular branch or tag, reset to it.
547
+ -- Otherwise, check out the default `HEAD`.
548
+ let ref = fromMaybe " HEAD" $ srpBranch `mplus` srpTag
587
549
git localDir $
588
550
" reset"
589
551
: verboseArg
@@ -609,7 +571,7 @@ vcsGit =
609
571
}
610
572
611
573
cloneArgs =
612
- [" clone" , " --depth=1 " , " -- no-checkout" , loc, localDir]
574
+ [" clone" , " --no-checkout" , loc, localDir]
613
575
++ case peer of
614
576
Nothing -> []
615
577
Just peerLocalDir -> [" --reference" , peerLocalDir]
0 commit comments