diff options
Diffstat (limited to 'pkgs/populate/tests')
| -rw-r--r-- | pkgs/populate/tests/scenarios.nix | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/pkgs/populate/tests/scenarios.nix b/pkgs/populate/tests/scenarios.nix index 96804f8..f7ece9a 100644 --- a/pkgs/populate/tests/scenarios.nix +++ b/pkgs/populate/tests/scenarios.nix @@ -1172,6 +1172,51 @@ in } ]; })) + # Symlink and git sources with nothing to do get skipped: the symlink + # stays the same file, which ln would replace. A symlink pointing + # elsewhere, and a modified file, an untracked one, and another commit + # in the work tree make them deliver again. + (s "symlink-git-skip" (let + sources = { + l.symlink = "g"; + g.git = { url = gitUrl; ref = gitHead; }; + }; + delivered = '' + expect_eq l "$(readlink "$T"/l)" g + expect_eq HEAD "$(git -C "$T"/g rev-parse HEAD)" ${gitHead} + expect_eq status "$(git -C "$T"/g status --porcelain --ignored)" "" + ''; + in { + phases = [ + { + inherit sources; + check = delivered; + mutate = '' + stat -c %i "$T"/l > "$T"/inode + ''; + } + # Nothing to do, so the symlink stays. + { + inherit sources; + check = delivered + '' + expect_eq inode "$(stat -c %i "$T"/l)" "$(cat "$T"/inode)" + ''; + mutate = '' + ln -sfn elsewhere "$T"/l + echo modified >> "$T"/g/flake.nix + echo new > "$T"/g/new + ''; + } + { + inherit sources; + check = delivered; + mutate = '' + git -C "$T"/g -c user.name=x -c user.email=x commit -q --allow-empty -m other + ''; + } + { inherit sources; check = delivered; } + ]; + })) (s "cycle" { phases = [{ sources = { |
