aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-10-30 13:18:28 +0100
committerEelco Dolstra <edolstra@gmail.com>2017-10-30 13:18:28 +0100
commit63c80ae26fcde8cc2e18a01e325ef214de084517 (patch)
tree740dcbc897670ff4a01b2261c880d3edacadf770 /src/libexpr/primops
parenta5c392a80e2965f0bf4855309a1ae326ff625ba2 (diff)
Make "fetchGit /path" work
Diffstat (limited to 'src/libexpr/primops')
-rw-r--r--src/libexpr/primops/fetchgit.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libexpr/primops/fetchgit.cc b/src/libexpr/primops/fetchgit.cc
index 2b1d366ff..4af530124 100644
--- a/src/libexpr/primops/fetchgit.cc
+++ b/src/libexpr/primops/fetchgit.cc
@@ -117,6 +117,7 @@ static void prim_fetchGit(EvalState & state, const Pos & pos, Value * * args, Va
std::string ref = "master";
std::string rev;
std::string name = "source";
+ PathSet context;
state.forceValue(*args[0]);
@@ -126,11 +127,8 @@ static void prim_fetchGit(EvalState & state, const Pos & pos, Value * * args, Va
for (auto & attr : *args[0]->attrs) {
string n(attr.name);
- if (n == "url") {
- PathSet context;
+ if (n == "url")
url = state.coerceToString(*attr.pos, *attr.value, context, false, false);
- if (hasPrefix(url, "/")) url = "file://" + url;
- }
else if (n == "ref")
ref = state.forceStringNoCtx(*attr.value, *attr.pos);
else if (n == "rev")
@@ -145,7 +143,9 @@ static void prim_fetchGit(EvalState & state, const Pos & pos, Value * * args, Va
throw EvalError(format("'url' argument required, at %1%") % pos);
} else
- url = state.forceStringNoCtx(*args[0], pos);
+ url = state.coerceToString(pos, *args[0], context, false, false);
+
+ if (hasPrefix(url, "/")) url = "file://" + url;
// FIXME: git externals probably can be used to bypass the URI
// whitelist. Ah well.