about summary refs log tree commit diff
path: root/src/libexpr/primops
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-03-02T10·46+0100
committerEelco Dolstra <edolstra@gmail.com>2017-03-02T10·46+0100
commitffcf9d24a68fd166f5c60ebae721a9badc469b0e (patch)
treec7c0b41cc2a8d5950e99942c89dd9e432e00b6b4 /src/libexpr/primops
parentfbf17f1ad7259f08ab53dc8319ae0f452321f081 (diff)
builtins.fetchgit: Support paths
Diffstat (limited to 'src/libexpr/primops')
-rw-r--r--src/libexpr/primops/fetchgit.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libexpr/primops/fetchgit.cc b/src/libexpr/primops/fetchgit.cc
index 6a5b5ac36e6b..09e2c077baba 100644
--- a/src/libexpr/primops/fetchgit.cc
+++ b/src/libexpr/primops/fetchgit.cc
@@ -58,9 +58,11 @@ static void prim_fetchgit(EvalState & state, const Pos & pos, Value * * args, Va
 
         for (auto & attr : *args[0]->attrs) {
             string name(attr.name);
-            if (name == "url")
-                url = state.forceStringNoCtx(*attr.value, *attr.pos);
-            else if (name == "rev")
+            if (name == "url") {
+                PathSet context;
+                url = state.coerceToString(*attr.pos, *attr.value, context, false, false);
+                if (hasPrefix(url, "/")) url = "file://" + url;
+            } else if (name == "rev")
                 rev = state.forceStringNoCtx(*attr.value, *attr.pos);
             else
                 throw EvalError("unsupported argument ‘%s’ to ‘fetchgit’, at %s", attr.name, *attr.pos);