Skip to content

Commit

Permalink
TarballInputScheme: Fix fetchToStore() caching
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed May 3, 2024
1 parent 7332321 commit 299d0b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/libfetchers/fetchers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ std::pair<ref<InputAccessor>, Input> Input::getAccessorUnchecked(ref<Store> stor

auto [accessor, final] = scheme->getAccessor(store, *this);

accessor->fingerprint = scheme->getFingerprint(store, final);
if (!accessor->fingerprint)
// FIXME: remove getFingerprint()?
accessor->fingerprint = scheme->getFingerprint(store, final);

return {accessor, std::move(final)};
}
Expand Down
7 changes: 5 additions & 2 deletions src/libfetchers/tarball.cc
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,11 @@ struct TarballInputScheme : CurlInputScheme
if (result.lastModified && !input.attrs.contains("lastModified"))
input.attrs.insert_or_assign("lastModified", uint64_t(result.lastModified));

input.attrs.insert_or_assign("narHash",
getTarballCache()->treeHashToNarHash(result.treeHash).to_string(HashFormat::SRI, true));
auto narHash = getTarballCache()->treeHashToNarHash(result.treeHash).to_string(HashFormat::SRI, true);

input.attrs.insert_or_assign("narHash", narHash);

result.accessor->fingerprint = narHash;

return {result.accessor, input};
}
Expand Down

0 comments on commit 299d0b7

Please sign in to comment.