Shrink diff in two places

Stuff crept in there.
This commit is contained in:
John Ericson 2023-01-30 09:59:55 -05:00
parent adb3608034
commit 974a983351
2 changed files with 10 additions and 7 deletions

View file

@ -17,8 +17,9 @@ std::string makeFileIngestionPrefix(FileIngestionMethod m)
return ""; return "";
case FileIngestionMethod::Recursive: case FileIngestionMethod::Recursive:
return "r:"; return "r:";
default:
throw Error("impossible, caught both cases");
} }
assert(false);
} }
std::string makeFixedOutputCA(FileIngestionMethod method, const Hash & hash) std::string makeFixedOutputCA(FileIngestionMethod method, const Hash & hash)

View file

@ -31,12 +31,14 @@ std::map<StorePath, StorePath> makeContentAddressed(
for (auto & ref : oldInfo->references) { for (auto & ref : oldInfo->references) {
if (ref == path) if (ref == path)
refs.self = true; refs.self = true;
auto i = remappings.find(ref); else {
auto replacement = i != remappings.end() ? i->second : ref; auto i = remappings.find(ref);
// FIXME: warn about unremapped paths? auto replacement = i != remappings.end() ? i->second : ref;
if (replacement != ref) { // FIXME: warn about unremapped paths?
rewrites.insert_or_assign(srcStore.printStorePath(ref), srcStore.printStorePath(replacement)); if (replacement != ref) {
refs.others.insert(std::move(replacement)); rewrites.insert_or_assign(srcStore.printStorePath(ref), srcStore.printStorePath(replacement));
refs.others.insert(std::move(replacement));
}
} }
} }