mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 17:16:15 +02:00
Add more test for git submodule functionality
This commit is contained in:
parent
c8d33de777
commit
c846abb5cc
1 changed files with 11 additions and 0 deletions
|
@ -40,12 +40,23 @@ rev=$(git -C $rootRepo rev-parse HEAD)
|
||||||
|
|
||||||
pathWithoutSubmodules=$(nix eval --raw "(builtins.fetchGit { url = file://$rootRepo; rev = \"$rev\"; }).outPath")
|
pathWithoutSubmodules=$(nix eval --raw "(builtins.fetchGit { url = file://$rootRepo; rev = \"$rev\"; }).outPath")
|
||||||
pathWithSubmodules=$(nix eval --raw "(builtins.fetchGit { url = file://$rootRepo; rev = \"$rev\"; fetchSubmodules = true; }).outPath")
|
pathWithSubmodules=$(nix eval --raw "(builtins.fetchGit { url = file://$rootRepo; rev = \"$rev\"; fetchSubmodules = true; }).outPath")
|
||||||
|
pathWithSubmodulesAgain=$(nix eval --raw "(builtins.fetchGit { url = file://$rootRepo; rev = \"$rev\"; fetchSubmodules = true; }).outPath")
|
||||||
|
|
||||||
# The resulting store path cannot be the same.
|
# The resulting store path cannot be the same.
|
||||||
[[ $pathWithoutSubmodules != $pathWithSubmodules ]]
|
[[ $pathWithoutSubmodules != $pathWithSubmodules ]]
|
||||||
|
|
||||||
|
# Checking out the same repo with submodules returns in the same store path.
|
||||||
|
[[ $pathWithSubmodules == $pathWithSubmodulesAgain ]]
|
||||||
|
|
||||||
|
# The submodules flag is actually honored.
|
||||||
[[ ! -e $pathWithoutSubmodules/sub/content ]]
|
[[ ! -e $pathWithoutSubmodules/sub/content ]]
|
||||||
[[ -e $pathWithSubmodules/sub/content ]]
|
[[ -e $pathWithSubmodules/sub/content ]]
|
||||||
|
|
||||||
# No .git directory or submodule reference files must be left
|
# No .git directory or submodule reference files must be left
|
||||||
test "$(find "$pathWithSubmodules" -name .git)" = ""
|
test "$(find "$pathWithSubmodules" -name .git)" = ""
|
||||||
|
|
||||||
|
# Git repos without submodules can be fetched with submodules = true.
|
||||||
|
noSubmoduleRepoBaseline=$(nix eval --raw "(builtins.fetchGit { url = file://$subRepo; rev = \"$rev\"; }).outPath")
|
||||||
|
noSubmoduleRepo=$(nix eval --raw "(builtins.fetchGit { url = file://$subRepo; rev = \"$rev\"; fetchSubmodules = true; }).outPath")
|
||||||
|
|
||||||
|
[[ $noSubmoduleRepoBaseline == $noSubmoduleRepo ]]
|
||||||
|
|
Loading…
Reference in a new issue