1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-04 23:51:47 +02:00

Add helper function printInputPath()

This commit is contained in:
Eelco Dolstra 2020-06-10 15:20:00 +02:00
parent 29e0748847
commit fc6c7af424
3 changed files with 21 additions and 12 deletions

View file

@ -236,15 +236,15 @@ std::string diffLockFiles(const LockFile & oldLocks, const LockFile & newLocks)
while (i != oldFlat.end() || j != newFlat.end()) {
if (j != newFlat.end() && (i == oldFlat.end() || i->first > j->first)) {
res += fmt("* Added '%s': '%s'\n", concatStringsSep("/", j->first), j->second->lockedRef);
res += fmt("* Added '%s': '%s'\n", printInputPath(j->first), j->second->lockedRef);
++j;
} else if (i != oldFlat.end() && (j == newFlat.end() || i->first < j->first)) {
res += fmt("* Removed '%s'\n", concatStringsSep("/", i->first));
res += fmt("* Removed '%s'\n", printInputPath(i->first));
++i;
} else {
if (!(i->second->lockedRef == j->second->lockedRef)) {
res += fmt("* Updated '%s': '%s' -> '%s'\n",
concatStringsSep("/", i->first),
printInputPath(i->first),
i->second->lockedRef,
j->second->lockedRef);
}
@ -256,4 +256,9 @@ std::string diffLockFiles(const LockFile & oldLocks, const LockFile & newLocks)
return res;
}
std::string printInputPath(const InputPath & path)
{
return concatStringsSep("/", path);
}
}