forked from lix-project/lix
28 lines
621 B
C++
28 lines
621 B
C++
|
#include "file-hash.hh"
|
||
|
|
||
|
namespace nix {
|
||
|
|
||
|
std::string FileSystemHash::printMethodAlgo() const {
|
||
|
return makeFileIngestionPrefix(method) + printHashType(hash.type);
|
||
|
}
|
||
|
|
||
|
std::string makeFileIngestionPrefix(const FileIngestionMethod m) {
|
||
|
switch (m) {
|
||
|
case FileIngestionMethod::Flat:
|
||
|
return "";
|
||
|
case FileIngestionMethod::Recursive:
|
||
|
return "r:";
|
||
|
default:
|
||
|
throw Error("impossible, caught both cases");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
std::string makeFixedOutputCA(FileIngestionMethod method, const Hash & hash)
|
||
|
{
|
||
|
return "fixed:"
|
||
|
+ makeFileIngestionPrefix(method)
|
||
|
+ hash.to_string();
|
||
|
}
|
||
|
|
||
|
}
|