diff options
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/libstore/store-api.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/nix/libstore/store-api.cc b/nix/libstore/store-api.cc index 6445209652e..feabc821678 100644 --- a/nix/libstore/store-api.cc +++ b/nix/libstore/store-api.cc | |||
| @@ -236,18 +236,25 @@ Path makeFixedOutputPath(bool recursive, | |||
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | 238 | ||
| 239 | Path computeStorePathForText(const string & name, const string & s, | 239 | /* Return the 'type' part of a text store item with the given REFERENCES. */ |
| 240 | const PathSet & references) | 240 | static string textTypeWithReferences(const PathSet & references) |
| 241 | { | 241 | { |
| 242 | Hash hash = hashString(htSHA256, s); | ||
| 243 | /* Stuff the references (if any) into the type. This is a bit | 242 | /* Stuff the references (if any) into the type. This is a bit |
| 244 | hacky, but we can't put them in `s' since that would be | 243 | hacky, but we can't put them in the file content since that would be |
| 245 | ambiguous. */ | 244 | ambiguous. */ |
| 246 | string type = "text"; | 245 | string type = "text"; |
| 247 | for (const auto& i : references) { | 246 | for (const auto& i : references) { |
| 248 | type += ":"; | 247 | type += ":"; |
| 249 | type += i; | 248 | type += i; |
| 250 | } | 249 | } |
| 250 | return type; | ||
| 251 | } | ||
| 252 | |||
| 253 | Path computeStorePathForText(const string & name, const string & s, | ||
| 254 | const PathSet & references) | ||
| 255 | { | ||
| 256 | Hash hash = hashString(htSHA256, s); | ||
| 257 | string type = textTypeWithReferences(references); | ||
| 251 | return makeStorePath(type, hash, name); | 258 | return makeStorePath(type, hash, name); |
| 252 | } | 259 | } |
| 253 | 260 | ||
