packages feed

pantry 0.8.2 → 0.8.2.1

raw patch · 3 files changed

+18/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for pantry
 
+## v0.8.2.1
+
+* On Windows, avoid fatal `tar: Cannot connect to C: resolve failed` bug when
+  archiving repository submodules.
+
 ## v0.8.2
 
 * `PantryException` is now an instance of the
pantry.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           pantry-version:        0.8.2+version:        0.8.2.1 synopsis:       Content addressable Haskell package management description:    Please see the README on GitHub at <https://github.com/commercialhaskell/pantry#readme> category:       Development
src/Pantry/Repo.hs view
@@ -33,6 +33,17 @@ 
 data TarType = Gnu | Bsd
 
+getGitTarType :: (HasProcessContext env, HasLogFunc env) => RIO env TarType
+getGitTarType = if osIsWindows
+  then do
+    (_, stdoutBS, _) <- proc "git" ["--version"] readProcess
+    let bs = toStrict stdoutBS
+    -- If using Git for Windows, then assume that the tar type within
+    -- `git submodule foreach <command>` is the Git-supplied\MSYS2-supplied
+    -- GNU tar
+    if "windows" `isInfixOf` bs then pure Gnu else getTarType
+  else getTarType
+
 getTarType :: (HasProcessContext env, HasLogFunc env) => RIO env TarType
 getTarType = do
   (_, stdoutBS, _) <- proc "tar" ["--version"] readProcess
@@ -200,7 +211,7 @@ -- done in GNU tar with -A option.
 archiveSubmodules :: (HasLogFunc env, HasProcessContext env) => FilePath -> RIO env ()
 archiveSubmodules tarball = do
-  tarType <- getTarType
+  tarType <- getGitTarType
   let forceLocal =
           if osIsWindows
           then " --force-local "