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:
parent
479757dc15
commit
0f840483c7
7 changed files with 61 additions and 30 deletions
|
|
@ -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) {};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue