aboutsummaryrefslogtreecommitdiff
path: root/src/nix
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 /src/nix
parent940e9eb8dd6deacb2e41aca91d65bd0e616011d6 (diff)
Add `dirtyRev` and `dirtyShortRev` to `fetchGit`
Fixes #4682
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/flake.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 1eea52e15..8d39de389 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -179,6 +179,8 @@ struct CmdFlakeMetadata : FlakeCommand, MixJSON
j["locked"] = fetchers::attrsToJSON(flake.lockedRef.toAttrs());
if (auto rev = flake.lockedRef.input.getRev())
j["revision"] = rev->to_string(Base16, false);
+ if (auto dirtyRev = fetchers::maybeGetStrAttr(flake.lockedRef.toAttrs(), "dirtyRev"))
+ j["dirtyRevision"] = *dirtyRev;
if (auto revCount = flake.lockedRef.input.getRevCount())
j["revCount"] = *revCount;
if (auto lastModified = flake.lockedRef.input.getLastModified())
@@ -204,6 +206,10 @@ struct CmdFlakeMetadata : FlakeCommand, MixJSON
logger->cout(
ANSI_BOLD "Revision:" ANSI_NORMAL " %s",
rev->to_string(Base16, false));
+ if (auto dirtyRev = fetchers::maybeGetStrAttr(flake.lockedRef.toAttrs(), "dirtyRev"))
+ logger->cout(
+ ANSI_BOLD "Revision:" ANSI_NORMAL " %s",
+ *dirtyRev);
if (auto revCount = flake.lockedRef.input.getRevCount())
logger->cout(
ANSI_BOLD "Revisions:" ANSI_NORMAL " %s",