diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-07-08 14:33:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 14:33:49 +0200 |
commit | 8648143120c60c9e104e5b2fd3beee2cfd2268d2 (patch) | |
tree | 5f33c56bf64878483349ce10856cfb04468b57ae /src/libexpr | |
parent | 2172e60f7a53a56ff1ce04f3b683fb618fc5d3f7 (diff) | |
parent | 7e5c79a2d210e7b986803d5fe5c7ebb504b3e74e (diff) |
Merge pull request #4988 from NixOS/fetchgit-name-attribute
Add a name attribute to the fetchers
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/primops/fetchMercurial.cc | 1 | ||||
-rw-r--r-- | src/libexpr/primops/fetchTree.cc | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/libexpr/primops/fetchMercurial.cc b/src/libexpr/primops/fetchMercurial.cc index 4830ebec3..3f88ccb91 100644 --- a/src/libexpr/primops/fetchMercurial.cc +++ b/src/libexpr/primops/fetchMercurial.cc @@ -62,6 +62,7 @@ static void prim_fetchMercurial(EvalState & state, const Pos & pos, Value * * ar fetchers::Attrs attrs; attrs.insert_or_assign("type", "hg"); attrs.insert_or_assign("url", url.find("://") != std::string::npos ? url : "file://" + url); + attrs.insert_or_assign("name", name); if (ref) attrs.insert_or_assign("ref", *ref); if (rev) attrs.insert_or_assign("rev", rev->gitRev()); auto input = fetchers::Input::fromAttrs(std::move(attrs)); diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index c593400a7..5603b6036 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -129,6 +129,13 @@ static void fetchTree( .errPos = pos }); + if (auto nameIter = attrs.find("name"); nameIter != attrs.end()) + throw Error({ + .msg = hintfmt("attribute 'name' isn’t supported in call to 'fetchTree'"), + .errPos = pos + }); + + input = fetchers::Input::fromAttrs(std::move(attrs)); } else { auto url = state.coerceToString(pos, *args[0], context, false, false); |