aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThéophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>2022-06-29 18:21:07 +0200
committerGitHub <noreply@github.com>2022-06-29 18:21:07 +0200
commitb7eb4ac1692e289912f3988c0e28bb2c778a4f7a (patch)
treecbceab8b9c8af98f9793c761a3dfaada4800edbf /tests
parent4c8210095e7ed8de2eb4789b0ac6f9b4a39e394e (diff)
parent83f96e61a43b77677e14cdf415f1a30d37b17f18 (diff)
Merge pull request #6699 from tennox/better-flake-new-error-message
flakes: apply templates partially on conflicts
Diffstat (limited to 'tests')
-rw-r--r--tests/flakes.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/flakes.sh b/tests/flakes.sh
index 36bffcf3b..35cf4d8e7 100644
--- a/tests/flakes.sh
+++ b/tests/flakes.sh
@@ -408,8 +408,10 @@ cat > $templatesDir/trivial/flake.nix <<EOF
};
}
EOF
+echo a > $templatesDir/trivial/a
+echo b > $templatesDir/trivial/b
-git -C $templatesDir add flake.nix trivial/flake.nix
+git -C $templatesDir add flake.nix trivial/
git -C $templatesDir commit -m 'Initial'
nix flake check templates
@@ -424,6 +426,18 @@ nix flake show $flake7Dir
nix flake show $flake7Dir --json | jq
git -C $flake7Dir commit -a -m 'Initial'
+# Test 'nix flake init' with benign conflicts
+rm -rf $flake7Dir && mkdir $flake7Dir && git -C $flake7Dir init
+echo a > $flake7Dir/a
+(cd $flake7Dir && nix flake init) # check idempotence
+
+# Test 'nix flake init' with conflicts
+rm -rf $flake7Dir && mkdir $flake7Dir && git -C $flake7Dir init
+echo b > $flake7Dir/a
+pushd $flake7Dir
+(! nix flake init) |& grep "refusing to overwrite existing file '$flake7Dir/a'"
+popd
+
# Test 'nix flake new'.
rm -rf $flake6Dir
nix flake new -t templates#trivial $flake6Dir