summary refs log tree commit diff
diff options
context:
space:
mode:
authorArun Isaac2022-02-28 15:07:29 +0530
committerArun Isaac2022-02-28 18:11:03 +0530
commit03400cab3490e6e21ee886083a2664ab32512b8f (patch)
tree832245a682eafeee2ca9360cfbfe154969d5b2a0
parent672556e2d9ff776d293f8fcdb250d0522f42f356 (diff)
downloadguix-forge-03400cab3490e6e21ee886083a2664ab32512b8f.tar.gz
guix-forge-03400cab3490e6e21ee886083a2664ab32512b8f.tar.lz
guix-forge-03400cab3490e6e21ee886083a2664ab32512b8f.zip
forge: Append file:// to local git repository URLs before cloning.
Shallow clone works on local git repositories only with a file:// URL.

* forge/build/git.scm (download-git-to-store): Append file:// to local
git repository URLs.
-rw-r--r--forge/build/git.scm7
1 files changed, 6 insertions, 1 deletions
diff --git a/forge/build/git.scm b/forge/build/git.scm
index 5978a3e..1434d07 100644
--- a/forge/build/git.scm
+++ b/forge/build/git.scm
@@ -55,7 +55,12 @@ downloaded. git and certificates should be in the environment."
                                   (invoke-error-exit-status condition))
                           (exit #f)))
          (apply invoke
-                "git" "clone" "--quiet" "--depth" "1" url
+                "git" "clone" "--quiet" "--depth" "1"
+                ;; Append file:// to local repository path so that
+                ;; shallow clone works.
+                (if (string-prefix? "/" url)
+                    (string-append "file://" url)
+                    url)
                 (append (if branch
                             (list "--branch" branch)
                             (list))