diff options
author | Nikolay Amiantov <ab@fmap.me> | 2016-03-04 13:47:19 +0300 |
---|---|---|
committer | Nikolay Amiantov <ab@fmap.me> | 2022-01-09 13:07:00 +0300 |
commit | c66865dff1747ecd55915ef8c549dc1a088ff168 (patch) | |
tree | 1b808d30f218739ebaa61d2f80b834803fa7b130 /src/libexpr/primops.cc | |
parent | 6d7844695bf14c1fc68f051df0b98db442863fc9 (diff) |
builtins.readFile: Propagate path context
Co-authored-by: Shea Levy <shea@shealevy.com>
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r-- | src/libexpr/primops.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index d7382af6b..1d2a7d5d2 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -1470,7 +1470,11 @@ static void prim_readFile(EvalState & state, const Pos & pos, Value * * args, Va string s = readFile(path); if (s.find((char) 0) != string::npos) throw Error("the contents of the file '%1%' cannot be represented as a Nix string", path); - v.mkString(s); + auto refs = state.store->isInStore(path) ? + state.store->queryPathInfo(state.store->toStorePath(path).first)->references : + StorePathSet{}; + auto context = state.store->printStorePathSet(refs); + v.mkString(s, context); } static RegisterPrimOp primop_readFile({ |