After recent update (I am on dev branch) I am getting error when trying to load my custom fork of org-mode repo:
signal(error ("No straight-host-usernames entry for host ‘nil’"))
error("No straight-host-usernames entry for host `%S'" nil)
straight-vc--host-username(nil)
straight-vc-git--fork-repo((:host nil :repo "https://code.orgmode.org/bzg/org-mode.git" :fork "/home/yantar92/Git/org-mode/"))
straight-vc-git--fork-repo((:type git :repo "https://code.orgmode.org/bzg/org-mode.git" :local-repo "org" :fork (:repo "/home/yantar92/Git/org-mode/")))
straight--convert-recipe((org :type git :repo "https://code.orgmode.org/bzg/org-mode.git" :local-repo "org" :files (:defaults "contrib/lisp/*.el") :fork (:repo "/home/yantar92/Git/org-mode/")) nil)
straight-use-package((org :type git :repo "https://code.orgmode.org/bzg/org-mode.git" :local-repo "org" :files (:defaults "contrib/lisp/*.el") :fork (:repo "/home/yantar92/Git/org-mode/")))
Try to load the following code (non-existing file paths should not matter):
(straight-use-package '(org
:type git :repo "https://code.orgmode.org/bzg/org-mode.git"
:local-repo "org"
:files (:defaults "contrib/lisp/*.el")
:fork (:repo "/home/yantar92/Git/org-mode/")))
Perhaps you have thoughts @progfolio, I think this is caused by https://github.com/raxod502/straight.el/blob/6cc9fcfd4b009c38bb6753ebd78fed5d377dced2/straight.el#L1616-L1625 transforming the (:repo "/home/yantar92/Git/org-mode/") into just "/home/yantar92/Git/org-mode/".
@yantar92: Apologies for the breakage and thank you for the detailed report.
I've pushed a fix at:
https://github.com/progfolio/straight.el/tree/fix/host-username-lookup-fails-with-nil-host-592
I'm testing locally with straight-bug-report:
Test Case
(straight-bug-report
:user-dir "straight-test-592"
:pre-bootstrap
(setq straight-repository-user "progfolio")
(setq straight-repository-branch "fix/host-username-lookup-fails-with-nil-host-592")
:post-bootstrap
(let*
((dir
(plist-get straight-bug-report-args :user-dir))
(default-directory dir))
(call-process "git" nil nil nil "clone" "https://code.orgmode.org/bzg/org-mode.git" "local-org-mode")
(straight-use-package
`(org :type git :repo "https://code.orgmode.org/bzg/org-mode.git" :local-repo "org" :files
(:defaults "contrib/lisp/*.el")
:fork
(:repo ,(expand-file-name "local-org-mode" dir))))))
2020-09-26 19:51:52gnu/linuxprerelease (HEAD -> fix/host-username-lookup-fails-with-nil-host-592, fork/fix/host-username-lookup-fails-with-nil-host-592) c8a2913 2020-09-26GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.3, Xaw3d scroll bars)
of 2020-09-15Output
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 straight recipe → Cloning emacsmirror-mirror...
Looking for straight recipe → Cloning emacsmirror-mirror...done
Building straight...
Building straight...done
Test run with version: prerelease (HEAD -> fix/host-username-lookup-fails-with-nil-host-592, origin/fix/host-username-lookup-fails-with-nil-host-592) c8a2913 2020-09-26
Cloning org...
Cloning org...done
Building org...
Building org...done
Which seems to work.
Would you mind testing this branch and confirming?
@raxod502: The failure happens in the pcase at the bottom of straight-vc-git--fork-repo.
I was unconditionally assuming a fork with a repository specified needed to look up a host in straight-host-usernames. I've made it conditional on the presence of a non-nil :host value. I think that should work. I've added a couple cases to the tests I had and all seems well as far as they're concerned:
Tests
(let ((straight-host-usernames '((github . "githubForker")
(gitlab . "gitlabForker")
(bitbucket . "bitbucketForker")))
(tests '(;; t = straight-host-username/inherited repository
(( :package "package" :host github :type git :repo "upstream/repo"
:fork t)
.
"githubForker/repo")
;; nil = inherited :repo
(( :package "package" :host github :type git :repo "upstream/repo"
:fork nil)
.
"upstream/repo")
;; string no slash = :fork/inherited repository
(( :package "package" :host github :type git :repo "upstream/repo"
:fork "forker")
.
"forker/repo")
;; string suffix slash = username
(( :package "package" :host github :type git :repo "upstream/repo"
:fork "forker/")
.
"forker/repo")
;; string prefixed slash = straight-host-username/:fork
(( :package "package" :host github :type git :repo "upstream/repo"
:fork "/rename")
.
"githubForker/rename")
;; full override string = :fork
(( :package "package" :host github :type git :repo "upstream/repo"
:fork "forker/rename")
.
"forker/rename")
;; lists
;;; :host = straight-host-username/inherited repository
(( :package "package" :host github :type git :repo "upstream/repo"
:fork (:host bitbucket))
.
"bitbucketForker/repo")
;;; :host + :repo repository = straight-host-username/:fork
(( :package "package" :host github :type git :repo "upstream/repo"
:fork (:repo "/rename" :host gitlab))
. "gitlabForker/rename")
;;; :host + :repo user = :fork/inherited repository
(( :package "package" :host github :type git :repo "upstream/repo"
:fork (:repo "gitlabForker2" :host gitlab))
. "gitlabForker2/repo")
;;; :host + full override = :fork
(( :package "package" :host github :type git :repo "upstream/repo"
:fork (:repo "forker/rename" :host gitlab))
. "forker/rename")
;;; :host nil + full override = :fork
(( :package "package" :host github :type git :repo "upstream/repo"
:fork (:repo "[email protected]:forker/rename" :host nil))
. "[email protected]:forker/rename")
;;; :repo username = :fork/inherited repository
(( :package "package" :host github :type git :repo "upstream/repo"
:fork (:repo "forker"))
. "forker/repo")
;;; :repo repository = straight-host-username/:fork
(( :package "package" :host github :type git :repo "upstream/repo"
:fork (:repo "/rename"))
. "githubForker/rename")
;;; full override = :fork
(( :package "package" :host github :type git :repo "upstream/repo"
:fork (:repo "forker/rename"))
. "forker/rename")
;; Regressions
;;; https://github.com/raxod502/straight.el/issues/592
;;; fork on local filesystem (no :host)
(( :package "package" :type git :repo "upstream/repo"
:fork (:repo "/local/repos/forker/rename"))
. "/local/repos/forker/rename")
;;; explicit :host nil on :fork
(( :package "package" :host github :type git :repo "upstream/repo"
:fork (:host nil :repo "/local/repos/forker/rename"))
. "/local/repos/forker/rename")
)))
(mapcar (lambda (test)
(let ((result (straight-vc-git--fork-repo (car test))))
(if (equal result (cdr test)) t `(,result))))
tests))
;; outputs => (t t t t t t t t t t t t t t t t)
Would you mind testing this branch and confirming?
I confirm that the error goes away.
Thank you for testing! I will merge this into the develop branch.