diff options
author | Shea Levy <shea@shealevy.com> | 2017-01-10T17·22-0500 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2017-01-10T17·22-0500 |
commit | 451c223deea17918454ae083dcfc0ea2b6103cab (patch) | |
tree | 0ceaa0ce59a4192c99722d9ab6d02f6adc91fd4d /src | |
parent | 7adb986e354a36b6d8953213754b0d032e371308 (diff) |
builtins.readFile: Put the references of the file, not those needed to realize the file, into the context
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/primops.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 4398cc951da2..5be61c647496 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -779,6 +779,9 @@ static void prim_readFile(EvalState & state, const Pos & pos, Value * * args, Va string s = readFile(state.checkSourcePath(path)); if (s.find((char) 0) != string::npos) throw Error(format("the contents of the file ‘%1%’ cannot be represented as a Nix string") % path); + context = state.store->isInStore(path) ? + state.store->queryPathInfo(state.store->toStorePath(path))->references : + PathSet{}; mkString(v, s.c_str(), context); } |