Export missing rev/shortRev attributes

This commit is contained in:
Eelco Dolstra 2019-05-08 13:38:32 +02:00
parent 0d1c2e5bae
commit 77e1f9010c
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -441,6 +441,8 @@ void callFlake(EvalState & state, const ResolvedFlake & resFlake, Value & v)
state.store->isValidPath(nonFlake.storePath); state.store->isValidPath(nonFlake.storePath);
mkString(*state.allocAttr(*vNonFlake, state.sOutPath), nonFlake.storePath, {nonFlake.storePath}); mkString(*state.allocAttr(*vNonFlake, state.sOutPath), nonFlake.storePath, {nonFlake.storePath});
// FIXME: add rev, shortRev, revCount, ...
} }
mkString(*state.allocAttr(v, state.sDescription), resFlake.flake.description); mkString(*state.allocAttr(v, state.sDescription), resFlake.flake.description);
@ -449,6 +451,13 @@ void callFlake(EvalState & state, const ResolvedFlake & resFlake, Value & v)
state.store->isValidPath(path); state.store->isValidPath(path);
mkString(*state.allocAttr(v, state.sOutPath), path, {path}); mkString(*state.allocAttr(v, state.sOutPath), path, {path});
if (resFlake.flake.resolvedRef.rev) {
mkString(*state.allocAttr(v, state.symbols.create("rev")),
resFlake.flake.resolvedRef.rev->gitRev());
mkString(*state.allocAttr(v, state.symbols.create("shortRev")),
resFlake.flake.resolvedRef.rev->gitShortRev());
}
if (resFlake.flake.revCount) if (resFlake.flake.revCount)
mkInt(*state.allocAttr(v, state.symbols.create("revCount")), *resFlake.flake.revCount); mkInt(*state.allocAttr(v, state.symbols.create("revCount")), *resFlake.flake.revCount);