aboutsummaryrefslogtreecommitdiff
path: root/tests/flakes/flakes.sh
diff options
context:
space:
mode:
authorMichael Hoang <enzime@users.noreply.github.com>2021-10-14 23:44:45 +1100
committerMichael Hoang <enzime@users.noreply.github.com>2023-06-24 14:17:25 +1000
commita7b49086c76bc181ab1cf1d3c7fba44b06d2f1dd (patch)
tree63bad3884a9a0ea16fa4e587d0afb41ba9ea7d83 /tests/flakes/flakes.sh
parent940e9eb8dd6deacb2e41aca91d65bd0e616011d6 (diff)
Add `dirtyRev` and `dirtyShortRev` to `fetchGit`
Fixes #4682
Diffstat (limited to 'tests/flakes/flakes.sh')
-rw-r--r--tests/flakes/flakes.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/flakes/flakes.sh b/tests/flakes/flakes.sh
index f2e216435..128f759ea 100644
--- a/tests/flakes/flakes.sh
+++ b/tests/flakes/flakes.sh
@@ -95,11 +95,16 @@ json=$(nix flake metadata flake1 --json | jq .)
[[ $(echo "$json" | jq -r .lastModified) = $(git -C $flake1Dir log -n1 --format=%ct) ]]
hash1=$(echo "$json" | jq -r .revision)
+echo foo > $flake1Dir/foo
+git -C $flake1Dir add $flake1Dir/foo
+[[ $(nix flake metadata flake1 --json --refresh | jq -r .dirtyRevision) == "$hash1-dirty" ]]
+
echo -n '# foo' >> $flake1Dir/flake.nix
flake1OriginalCommit=$(git -C $flake1Dir rev-parse HEAD)
git -C $flake1Dir commit -a -m 'Foo'
flake1NewCommit=$(git -C $flake1Dir rev-parse HEAD)
hash2=$(nix flake metadata flake1 --json --refresh | jq -r .revision)
+[[ $(nix flake metadata flake1 --json --refresh | jq -r .dirtyRevision) == "null" ]]
[[ $hash1 != $hash2 ]]
# Test 'nix build' on a flake.