diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-03-17 21:34:38 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-03-17 22:35:29 +0100 |
commit | d1165d8791f559352ff6aa7348e1293b2873db1c (patch) | |
tree | 50137d50b7a7deda345c7fa1a13a4ba949783eb5 /src/libexpr | |
parent | 2a4e4f6a6e021481f0e92b7d3006345e68e77684 (diff) |
Require shallow clones to be requested explicitly
If you do a fetchTree on a Git repository, whether the result contains
a revCount attribute should not depend on whether that repository
happens to be a shallow clone or not. That would complicate caching a
lot and would be semantically messy. So applying fetchTree/fetchGit to
a shallow repository is now an error unless you pass the attribute
'shallow = true'. If 'shallow = true', we don't return revCount, even
if the repository is not actually shallow.
Note that Nix itself is not doing shallow clones at the moment. But it
could do so as an optimisation if the user specifies 'shallow = true'.
Issue #2988.
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/eval.cc | 2 | ||||
-rw-r--r-- | src/libexpr/primops/fetchTree.cc | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 852e8aa11..6fcb2917c 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -158,7 +158,7 @@ string showType(ValueType type) { switch (type) { case tInt: return "an integer"; - case tBool: return "a boolean"; + case tBool: return "a Boolean"; case tString: return "a string"; case tPath: return "a path"; case tNull: return "null"; diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index a9becddd9..2b3f1b76d 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -58,8 +58,10 @@ static void prim_fetchTree(EvalState & state, const Pos & pos, Value * * args, V state.forceValue(*attr.value); if (attr.value->type == tString) attrs.emplace(attr.name, attr.value->string.s); + else if (attr.value->type == tBool) + attrs.emplace(attr.name, attr.value->boolean); else - throw TypeError("fetchTree argument '%s' is %s while a string is expected", + throw TypeError("fetchTree argument '%s' is %s while a string or Boolean is expected", attr.name, showType(*attr.value)); } |