progfolio / elpaca

An elisp package manager
GNU General Public License v3.0
634 stars 31 forks source link

[Support]: :branch not checked out despite being specified in elpaca macro #196

Closed ashton314 closed 11 months ago

ashton314 commented 11 months ago

Confirmation

Elpaca Version

Elpaca d1c245d HEAD -> master, origin/refactor/messaging, origin/master, origin/HEAD
installer:      0.5
emacs-version:  GNU Emacs 29.1.50 (build 1, aarch64-apple-darwin22.6.0, NS appkit-2299.70 Version 13.5 (Build 22G74))
 of 2023-08-03
git --version:  git version 2.42.0

Operating System

macOS 14.1 (Sonoma)

Description

I'm running this:

(elpaca-test
  :interactive t
  :init
  (elpaca racket-mode
    :host "github"
    :repo "greghendershott/racket-mode"
    :branch "hash-lang"))

But when the new Emacs sessions pops up, the master branch of the racket-mode repo is what's checked out. I'd expect the hash-lang branch to be checked out. Am I holding this wrong?

progfolio commented 11 months ago

[W]hen the new Emacs sessions pops up, the master branch of the racket-mode repo is what's checked out. I'd expect the hash-lang branch to be checked out.

Thanks for taking the time to fill out a support ticket. There are a couple of details at play here.

First, the elpaca macro takes the entire order as its first argument, and anything after that is considered part of the macro BODY (which is executed after the order's queue is processed). So in the test case you provided, the order is racket-mode. The rest of the args are evaluated later as part of the BODY, and aren't being included in the package recipe. To fix that, you'll want to wrap the recipe in a list:

(elpaca ( racket-mode
         :host "github"
         :repo "greghendershott/racket-mode"
         :branch "hash-lang"))

Second, the :host recipe keyword will insert its value verbatim in the URI if it is a string. Changing it to the symbol github will do the right thing (adding "www.github.com" to the URI). I've added a note to the documentation to hopefully make that distinction a little clearer.

Here's a test case with both changes which should do the right thing:

Test Case [How to run this test?](https://github.com/progfolio/elpaca/wiki/Troubleshooting#the-elpaca-test-macro) ```emacs-lisp (elpaca-test :init (elpaca (racket-mode :host github :repo "greghendershott/racket-mode" :branch "hash-lang")) (elpaca-wait) (elpaca-with-dir 'racket-mode repo (message "racket-mode current branch: %s" (elpaca-process-output "git" "branch")))) ```
Host Env
elpaca2be8ac1 HEAD -> master, origin/master, origin/HEAD
isntaller0.6
emacsGNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0) of 2023-11-02
gitgit version 2.42.0
Output ```emacs-lisp INFO Scraping files for loaddefs... INFO Scraping files for loaddefs...done GEN ../elpaca-autoloads.el Cloning into '/tmp/elpaca.3YnyIE/elpaca/repos/elpaca'... Your branch is up to date with 'origin/master'. Checking /tmp/elpaca.3YnyIE/elpaca/repos/elpaca... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/elpaca-info.el... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/elpaca-log.el... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/elpaca-manager.el... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/elpaca-menu-elpa.el... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/elpaca-menu-melpa.el... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/elpaca-menu-org.el... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/elpaca-process.el... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/elpaca-test.el... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/elpaca-ui.el... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/elpaca.el... Checking /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/doc... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/doc/early-init.el... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/doc/init.el... Checking /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/extensions... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/extensions/elpaca-use-package.el... Checking /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/images... Checking /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/test... Compiling /tmp/elpaca.3YnyIE/elpaca/repos/elpaca/test/elpaca-test.el... Done (Total of 11 files compiled, 3 skipped in 4 directories) Downloading MELPA recipes... Downloading MELPA recipes...100% Downloading NonGNU-devel ELPA... Downloading GNU-devel ELPA... Downloading NonGNU ELPA... Downloading GNU ELPA... racket-mode current branch: * hash-lang Test Env Elpaca 2be8ac1 HEAD -> master, origin/master, origin/HEAD installer: 0.6 emacs-version: GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0) of 2023-11-02 git --version: git version 2.42.0 ```

And your original test case modified with the above in mind:

(elpaca-test
  :interactive t
  :init (elpaca ( racket-mode
                  :host github
                  :repo "greghendershott/racket-mode"
                  :branch "hash-lang")))

Does that help?

ashton314 commented 11 months ago

I was totally holding it wrong—thanks for the help Nicholas!

progfolio commented 11 months ago

Glad that helps. Thank you.