Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/nix/flake.cc
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,11 @@ struct CmdFlakeMetadata : FlakeCommand, MixJSON
bool last = i + 1 == node.inputs.size();

if (auto lockedNode = std::get_if<0>(&input.second)) {
logger->cout("%s" ANSI_BOLD "%s" ANSI_NORMAL ": %s",
auto lastModified = (*lockedNode)->lockedRef.input.getLastModified ();
logger->cout("%s" ANSI_BOLD "%s" ANSI_NORMAL ": %s\t(%s)",
prefix + (last ? treeLast : treeConn), input.first,
(*lockedNode)->lockedRef);
(*lockedNode)->lockedRef,
std::put_time(std::localtime(&*lastModified), "%F %T"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will crash if lastModified is empty. You could use the describe() method in lockfile.cc, which does the following:

    auto s = fmt("'%s'", flakeRef.to_string());

    if (auto lastModified = flakeRef.input.getLastModified())
        s += fmt(" (%s)", std::put_time(std::gmtime(&*lastModified), "%Y-%m-%d"));


bool firstVisit = visited.insert(*lockedNode).second;

Expand Down