diff options
Diffstat (limited to 'tests/flakes/common.sh')
-rw-r--r-- | tests/flakes/common.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/flakes/common.sh b/tests/flakes/common.sh index aa45dffa9..43a589507 100644 --- a/tests/flakes/common.sh +++ b/tests/flakes/common.sh @@ -2,6 +2,13 @@ source ../common.sh registry=$TEST_ROOT/registry.json +requireGit() { + if [[ -z $(type -p git) ]]; then + echo "Git not installed; skipping flake tests" + exit 99 + fi +} + writeSimpleFlake() { local flakeDir="$1" cat > $flakeDir/flake.nix <<EOF @@ -34,3 +41,15 @@ writeDependentFlake() { } EOF } + +createGitRepo() { + local repo="$1" + local extraArgs="$2" + + rm -rf $repo $repo.tmp + mkdir -p $repo + + git -C $repo init $extraArgs + git -C $repo config user.email "foobar@example.com" + git -C $repo config user.name "Foobar" +} |