radian-software / straight.el

🍀 Next-generation, purely functional package manager for the Emacs hacker.
MIT License
2.71k stars 150 forks source link

Doc: clarify that `:fork` inherits settings from main repo #483

Open telotortium opened 4 years ago

telotortium commented 4 years ago

I was attempting to switch a fork of a Github package to use SSH instead of HTTPS and wrote the following:

(use-package org-gcal
  :straight (:host github :repo "kidd/org-gcal.el"
             :fork (:repo "git@github.com:telotortium/org-gcal.el")))

To my surprise, straight constructed the URL "https://github.com/git@github.com:telotortium/org-gcal.el" for the fork. It turns out that, even though :host is nil by default in a top-level straight recipe, the :fork clause inherits the keys from the top-level recipe, so there was an implicit :host github in the :fork recipe. The configuration

(use-package org-gcal
  :straight (:host github :repo "kidd/org-gcal.el"
             :fork (:host nil :repo "git@github.com:telotortium/org-gcal.el")))

gives me the expected repo URL "git@github.com:telotortium/org-gcal.el". It would be worth documenting this behavior of the :fork keyword explicitly, and also giving an example like this.

raxod502 commented 4 years ago

Yes, that sounds reasonable. It is intended behavior but it doesn't look particularly pretty from this angle. In fact, it would probably make sense to add a special case whereby if you provide a full URL when :host is non-nil, then it's taken as given rather than processed further.