aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-02-01 23:54:20 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-02-01 23:54:20 +0100
commit887730aab39dd63a37d49d72a07c6441ea3b2f92 (patch)
tree9bda18dac5be9832ea797a73fe375829ba9f9785 /src/libexpr/flake
parentb9d64f931893120834fa54ebf084764d2e22ba33 (diff)
Remove superfluous TreeInfo::rev field
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r--src/libexpr/flake/flake.cc16
-rw-r--r--src/libexpr/flake/lockfile.cc6
2 files changed, 10 insertions, 12 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc
index 59728e38d..27e390fcd 100644
--- a/src/libexpr/flake/flake.cc
+++ b/src/libexpr/flake/flake.cc
@@ -567,17 +567,21 @@ LockedFlake lockFlake(
return LockedFlake { .flake = std::move(flake), .lockFile = std::move(newLockFile) };
}
-static void emitSourceInfoAttrs(EvalState & state, const fetchers::Tree & sourceInfo, Value & vAttrs)
+static void emitSourceInfoAttrs(
+ EvalState & state,
+ const FlakeRef & flakeRef,
+ const fetchers::Tree & sourceInfo,
+ Value & vAttrs)
{
assert(state.store->isValidPath(sourceInfo.storePath));
auto pathS = state.store->printStorePath(sourceInfo.storePath);
mkString(*state.allocAttr(vAttrs, state.sOutPath), pathS, {pathS});
- if (sourceInfo.info.rev) {
+ if (auto rev = flakeRef.input->getRev()) {
mkString(*state.allocAttr(vAttrs, state.symbols.create("rev")),
- sourceInfo.info.rev->gitRev());
+ rev->gitRev());
mkString(*state.allocAttr(vAttrs, state.symbols.create("shortRev")),
- sourceInfo.info.rev->gitShortRev());
+ rev->gitShortRev());
}
if (sourceInfo.info.revCount)
@@ -639,7 +643,7 @@ static void prim_callFlake(EvalState & state, const Pos & pos, Value * * args, V
mkString(*state.allocAttr(v, state.sOutPath), pathS, {pathS});
- emitSourceInfoAttrs(state, sourceInfo, v);
+ emitSourceInfoAttrs(state, resolvedRef, sourceInfo, v);
v.attrs->sort();
}
@@ -672,7 +676,7 @@ void callFlake(EvalState & state,
auto & vSourceInfo = *state.allocValue();
state.mkAttrs(vSourceInfo, 8);
- emitSourceInfoAttrs(state, *flake.sourceInfo, vSourceInfo);
+ emitSourceInfoAttrs(state, flake.resolvedRef, *flake.sourceInfo, vSourceInfo);
vSourceInfo.attrs->sort();
vInputs.attrs->push_back(Attr(state.sSelf, &vRes));
diff --git a/src/libexpr/flake/lockfile.cc b/src/libexpr/flake/lockfile.cc
index 6773b2844..e2586ab93 100644
--- a/src/libexpr/flake/lockfile.cc
+++ b/src/libexpr/flake/lockfile.cc
@@ -58,10 +58,6 @@ static TreeInfo parseTreeInfo(const nlohmann::json & json)
else
throw Error("attribute 'narHash' missing in lock file");
- j = i2.find("rev");
- if (j != i2.end())
- info.rev = Hash((std::string) *j, htSHA1);
-
j = i2.find("revCount");
if (j != i2.end())
info.revCount = *j;
@@ -97,8 +93,6 @@ static nlohmann::json treeInfoToJson(const TreeInfo & info)
nlohmann::json json;
assert(info.narHash);
json["narHash"] = info.narHash.to_string(SRI);
- if (info.rev)
- json["rev"] = info.rev->gitRev();
if (info.revCount)
json["revCount"] = *info.revCount;
if (info.lastModified)