mirror of
https://github.com/NixOS/nix.git
synced 2025-11-29 13:41:00 +01:00
Fix read-only copyPathToStore()
This commit is contained in:
parent
95e4376434
commit
eb966921ca
3 changed files with 24 additions and 7 deletions
|
|
@ -230,6 +230,19 @@ std::pair<StorePath, Hash> Store::computeStorePathForPath(std::string_view name,
|
|||
}
|
||||
|
||||
|
||||
std::pair<StorePath, Hash> Store::computeStorePathFromDump(
|
||||
Source & dump,
|
||||
std::string_view name,
|
||||
FileIngestionMethod method,
|
||||
HashType hashAlgo) const
|
||||
{
|
||||
HashSink sink(hashAlgo);
|
||||
dump.drainInto(sink);
|
||||
auto hash = sink.finish().first;
|
||||
return {makeFixedOutputPath(method, hash, name), hash};
|
||||
}
|
||||
|
||||
|
||||
StorePath Store::computeStorePathForText(
|
||||
std::string_view name,
|
||||
std::string_view s,
|
||||
|
|
|
|||
|
|
@ -219,10 +219,17 @@ public:
|
|||
/* This is the preparatory part of addToStore(); it computes the
|
||||
store path to which srcPath is to be copied. Returns the store
|
||||
path and the cryptographic hash of the contents of srcPath. */
|
||||
// FIXME: remove
|
||||
std::pair<StorePath, Hash> computeStorePathForPath(std::string_view name,
|
||||
const Path & srcPath, FileIngestionMethod method = FileIngestionMethod::Recursive,
|
||||
HashType hashAlgo = htSHA256, PathFilter & filter = defaultPathFilter) const;
|
||||
|
||||
std::pair<StorePath, Hash> computeStorePathFromDump(
|
||||
Source & dump,
|
||||
std::string_view name,
|
||||
FileIngestionMethod method = FileIngestionMethod::Recursive,
|
||||
HashType hashAlgo = htSHA256) const;
|
||||
|
||||
/* Preparatory part of addTextToStore().
|
||||
|
||||
!!! Computation of the path should take the references given to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue