Straight.el: paredit fails to install with custom clone depth

Created on 23 Nov 2020  Â·  6Comments  Â·  Source: raxod502/straight.el

What's wrong

Installing paredit fails combined with (setq straight-vc-git-default-clone-depth 1).

Directions to reproduce

With ~/.emacs.d/init.el containing

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(setq straight-vc-git-default-clone-depth 1)

M-x straight-use-package RET paredit RET fails with the following stacktrace:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  substring(nil 0 0)
  replace-regexp-in-string("[^-0-9a-zA-Z_./\n]" "\\\\\\&" nil)
  shell-quote-argument(nil)
  mapconcat(shell-quote-argument ("git" "clone" "--origin" "origin" "--branch" nil "--no-checkout" "https://mumble.net/~campbell/git/paredit.git" "/Users/mpolden/.emacs.d/straight/repos/paredit/") " ")
  straight--process-run("git" "clone" "--origin" "origin" "--branch" nil "--no-checkout" "https://mumble.net/~campbell/git/paredit.git" "/Users/mpolden/.emacs.d/straight/repos/paredit/")
  apply(straight--process-run "git" ("clone" "--origin" "origin" "--branch" nil "--no-checkout" "https://mumble.net/~campbell/git/paredit.git" "/Users/mpolden/.emacs.d/straight/repos/paredit/"))
  straight--call("git" "clone" "--origin" "origin" "--branch" nil "--no-checkout" "https://mumble.net/~campbell/git/paredit.git" "/Users/mpolden/.emacs.d/straight/repos/paredit/")
  apply(straight--call "git" ("clone" "--origin" "origin" "--branch" nil "--no-checkout" "https://mumble.net/~campbell/git/paredit.git" "/Users/mpolden/.emacs.d/straight/repos/paredit/"))
  straight--get-call-raw("git" "clone" "--origin" "origin" "--branch" nil "--no-checkout" "https://mumble.net/~campbell/git/paredit.git" "/Users/mpolden/.emacs.d/straight/repos/paredit/")
  apply(straight--get-call-raw "git" ("clone" "--origin" "origin" "--branch" nil "--no-checkout" "https://mumble.net/~campbell/git/paredit.git" "/Users/mpolden/.emacs.d/straight/repos/paredit/"))
  straight--get-call("git" "clone" "--origin" "origin" "--branch" nil "--no-checkout" "https://mumble.net/~campbell/git/paredit.git" "/Users/mpolden/.emacs.d/straight/repos/paredit/")
  straight-vc-git--clone-internal(:depth full :remote "origin" :url "https://mumble.net/~campbell/git/paredit.git" :repo-dir "/Users/mpolden/.emacs.d/straight/repos/paredit/")
  straight-vc-git--clone-internal(:depth 1 :remote "origin" :url "https://mumble.net/~campbell/git/paredit.git" :repo-dir "/Users/mpolden/.emacs.d/straight/repos/paredit/" :branch "master" :commit nil)
  straight-vc-git-clone((:type git :flavor melpa :files ("paredit.el" "paredit-pkg.el") :repo "https://mumble.net/~campbell/git/paredit.git" :package "paredit" :local-repo "paredit") nil)
  apply(straight-vc-git-clone ((:type git :flavor melpa :files ("paredit.el" "paredit-pkg.el") :repo "https://mumble.net/~campbell/git/paredit.git" :package "paredit" :local-repo "paredit") nil))
  straight-vc(clone git (:type git :flavor melpa :files ("paredit.el" "paredit-pkg.el") :repo "https://mumble.net/~campbell/git/paredit.git" :package "paredit" :local-repo "paredit") nil)
  straight-vc-clone((:type git :flavor melpa :files ("paredit.el" "paredit-pkg.el") :repo "https://mumble.net/~campbell/git/paredit.git" :package "paredit" :local-repo "paredit"))
  straight--clone-repository((:type git :flavor melpa :files ("paredit.el" "paredit-pkg.el") :repo "https://mumble.net/~campbell/git/paredit.git" :package "paredit" :local-repo "paredit") nil)
  #f(compiled-function () #<bytecode 0x1fff332c3001>)()
  straight--transaction-exec(use-package-\(:type\ git\ :flavor\ melpa\ :files\ \(\"paredit\.el\"\ \"paredit-pkg\.el\"\)\ :repo\ \"https://mumble\.net/~campbell/git/paredit\.git\"\ :package\ \"paredit\"\ :local-repo\ \"paredit\"\)-nil-nil :now #f(compiled-function () #<bytecode 0x1fff332c3001>))
  straight-use-package(paredit)
  eval-buffer(#<buffer  *load*> nil "/Users/mpolden/.emacs.d/init.el" nil t)  ; Reading at buffer position 570
  load-with-code-conversion("/Users/mpolden/.emacs.d/init.el" "/Users/mpolden/.emacs.d/init.el" t t)
  load("/Users/mpolden/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1fff3323d755>) #f(compiled-function () #<bytecode 0x1fff3323d769>) t)
  command-line()
  normal-top-level()

With (setq straight-vc-git-default-clone-depth 'full) (the default), paredit is successfully installed.

Version information

  • Emacs version: GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95)) of 2020-08-12
  • Operating system: macOS 10.15.7.
branch bug git regression repository management shallow clone vc

Most helpful comment

Thanks! That solved the issue.

All 6 comments

Running git clone manually gives this:

$ git clone --origin origin --depth 1 --branch master --no-checkout "https://mumble.net/~campbell/git/paredit.git" "/tmp/test"
Cloning into '/tmp/test'...
fatal: dumb http transport does not support shallow capabilities

Could it be that the fallback mechanism fails to include the branch here? https://github.com/raxod502/straight.el/blame/master/straight.el#L2205-L2211

Thank you for the report. What's the output of straight-version?

I believe https://github.com/raxod502/straight.el/commit/a7251a3067b0056927f551af873f31dc1a8ba5e2
may have taken care of this. The following test passes on my gnu/linux system:


Test Case

(straight-bug-report
  :user-dir "straight-638"
  :post-bootstrap 
  (setq straight-vc-git-default-clone-depth 1)
  (straight-use-package 'paredit))

  • Test run at: 2020-11-23 12:54:24
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> develop, origin/develop) 1a7453a 2020-11-22
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.3, Xaw3d scroll bars) of 2020-11-21

Output

Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe → Cloning melpa...
Looking for gnu-elpa-mirror recipe → Cloning melpa...done
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe → Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe → Cloning el-get...
Looking for emacsmirror-mirror recipe → Cloning el-get...done
Looking for straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> develop, origin/develop) 1a7453a 2020-11-22
Cloning paredit...
Cloning paredit...done
Building paredit...
Building paredit...done

The change was merged into the develop branch yesterday, so I would try updating straight and seeing if the problem persists.

This happens with a fresh .emacs.d, i.e. just bootstrapped. straight-version is not set for me, but it looks like bootstrapping installs from master, not develop.

Try adding (setq straight-repository-branch "develop") before the bootstrapping code in your init.

Thanks! That solved the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dertuxmalwieder picture dertuxmalwieder  Â·  3Comments

parsoj picture parsoj  Â·  4Comments

enko picture enko  Â·  4Comments

aspiers picture aspiers  Â·  4Comments

eflanigan00 picture eflanigan00  Â·  4Comments