1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-21 00:11:08 +01:00

Add date of last commit to SourceInfo

This is primarily useful for version string generation, where we need
a monotonically increasing number. The revcount is the preferred thing
to use, but isn't available for GitHub flakes (since it requires
fetching the entire history). The last commit timestamp OTOH can be
extracted from GitHub tarballs.
This commit is contained in:
Eelco Dolstra 2019-05-28 20:34:02 +02:00
parent 479757dc15
commit 0f840483c7
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
7 changed files with 61 additions and 30 deletions

View file

@ -81,10 +81,22 @@ void writeRegistry(const FlakeRegistry &, const Path &);
struct SourceInfo
{
// Immutable flakeref that this source tree was obtained from.
FlakeRef resolvedRef;
Path storePath;
// Number of ancestors of the most recent commit.
std::optional<uint64_t> revCount;
Hash narHash; // store path hash
// NAR hash of the store path.
Hash narHash;
// A stable timestamp of this source tree. For Git and GitHub
// flakes, the commit date (not author date!) of the most recent
// commit.
std::optional<time_t> lastModified;
SourceInfo(const FlakeRef & resolvRef) : resolvedRef(resolvRef) {};
};