From 838d3671cccb693ccdb9db861d09aef83e7d2895 Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 25 Feb 2024 15:11:30 +0000 Subject: [PATCH] Fix #129 loadRawPackage works with submodules on Windows --- ChangeLog.md | 5 +++++ package.yaml | 2 +- pantry.cabal | 2 +- src/Pantry/Repo.hs | 20 +++++++++++++------- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index b22be2bb..2144f9b7 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,10 @@ # Changelog for pantry +## v0.9.3.3 + +* Bug fix: On Windows, `loadPackageRaw` supports repositories with submodules, + as intended. + ## v0.9.3.2 * Support `ansi-terminal-1.0.2`. diff --git a/package.yaml b/package.yaml index 622fbbd4..7c6497e1 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: pantry -version: 0.9.3.2 +version: 0.9.3.3 synopsis: Content addressable Haskell package management description: Please see the README on GitHub at category: Development diff --git a/pantry.cabal b/pantry.cabal index 10175a08..9af82ea5 100644 --- a/pantry.cabal +++ b/pantry.cabal @@ -5,7 +5,7 @@ cabal-version: 2.0 -- see: https://github.com/sol/hpack name: pantry -version: 0.9.3.2 +version: 0.9.3.3 synopsis: Content addressable Haskell package management description: Please see the README on GitHub at category: Development diff --git a/src/Pantry/Repo.hs b/src/Pantry/Repo.hs index 0b248ac7..f94e607c 100644 --- a/src/Pantry/Repo.hs +++ b/src/Pantry/Repo.hs @@ -243,13 +243,19 @@ archiveSubmodules tarball = do then " --force-local " else mempty case tarType of - Gnu -> runGitCommand - [ "submodule" - , "foreach" - , "--recursive" - , "git -c core.autocrlf=false archive --prefix=$displaypath/ -o bar.tar HEAD; " - <> "tar" <> forceLocal <> " -Af " <> tarball <> " bar.tar" - ] + Gnu -> do + -- Single quotation marks are required around tarball because otherwise, + -- in the foreach environment, the \ character in absolute paths on + -- Windows will be interpreted as escaping the following character. + let foreachCommand = + "git -c core.autocrlf=false archive --prefix=$displaypath/ -o bar.tar HEAD; " + <> "tar" <> forceLocal <> " -Af '" <> tarball <> "' bar.tar" + runGitCommand + [ "submodule" + , "foreach" + , "--recursive" + , foreachCommand + ] Bsd -> runGitCommand [ "submodule" , "foreach"