-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for repositories with submodules
`git archive` doesn't include files from git submodules in the generated archive. This patch uses `git submodule foreach` to explicitly generate an archive for each submodule and to append it to the main one with `tar` command. We also export `withRepo` which can be useful independently of repo archive creation.
- Loading branch information
Showing
3 changed files
with
114 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import StackTest | ||
import System.Directory (createDirectoryIfMissing,withCurrentDirectory) | ||
|
||
main :: IO () | ||
main = do | ||
let | ||
gitInit = do | ||
runShell "git init ." | ||
runShell "git config user.name Test" | ||
runShell "git config user.email test@test.com" | ||
|
||
createDirectoryIfMissing True "tmpSubSubRepo" | ||
withCurrentDirectory "tmpSubSubRepo" $ do | ||
gitInit | ||
stack ["new", "pkg ", defaultResolverArg] | ||
runShell "git add pkg" | ||
runShell "git commit -m SubSubCommit" | ||
|
||
createDirectoryIfMissing True "tmpSubRepo" | ||
withCurrentDirectory "tmpSubRepo" $ do | ||
gitInit | ||
runShell "git submodule add ../tmpSubSubRepo sub" | ||
runShell "git commit -a -m SubCommit" | ||
|
||
createDirectoryIfMissing True "tmpRepo" | ||
withCurrentDirectory "tmpRepo" $ do | ||
gitInit | ||
runShell "git submodule add ../tmpSubRepo sub" | ||
runShell "git commit -a -m Commit" | ||
|
||
stack ["new", defaultResolverArg, "tmpPackage"] | ||
|
||
withCurrentDirectory "tmpPackage" $ do | ||
-- add git dependency on repo with recursive submodules | ||
runShell "echo 'extra-deps:' >> stack.yaml" | ||
runShell "echo \"- git: $(cd ../tmpRepo && pwd)\" >> stack.yaml" | ||
runShell "echo \" commit: $(cd ../tmpRepo && git rev-parse HEAD)\" >> stack.yaml" | ||
runShell "echo ' subdir: sub/sub/pkg' >> stack.yaml" | ||
|
||
-- Setup the package | ||
stack ["setup"] | ||
|
||
-- cleanup | ||
removeDirIgnore "tmpRepo" | ||
removeDirIgnore "tmpSubRepo" | ||
removeDirIgnore "tmpSubSubRepo" | ||
removeDirIgnore "tmpPackage" |