Skip to content

a package that requires magit cannot be byte-compiled without git available #5490

@hab25

Description

@hab25

This is extremely similar to #4640, which was accepted; see there for reasons why one would want this.

Recall that during byte-compilation, requires take effect: https://www.gnu.org/software/emacs/manual/html_node/elisp/Named-Features.html#:~:text=When%20require%20is%20used%20at%20top%20level%20in%20a%20file%2C%20it%20takes%20effect%20when%20you%20byte%2Dcompile%20that%20file%20(see%20Byte%20Compilation)%20as%20well%20as%20when%20you%20load%20it

This was caused by the removal of ignore-errors here: 7fe84a4#diff-f9ce4e1fa926529ddc27ce396848ad0fa1ab5897c8cce930746321b91f4f52aaR122 .

Maybe the solution is to just wrap that magit--early-process-lines call like (unless byte-compile-current-file (magit--early-process-lines ...))?

(1) what behavior you expected

For it to be possible to byte-compile a package that requires magit without git available.

(2) what behavior you observed

Error: file-missing ("Searching for program" "No such file or directory" "git")
  call-process("git" nil #<buffer  *temp*-135090> nil "config" "--get-all" "credential.helper")

  [...]

  byte-compile-file-form-require((require 'magit))

  [...]

  byte-compile-file("/nix/store/i531b7riw6q5yh4gyadmmwb4x92whnj8-emacs-difftastic-20251202.1715/share/emacs/site-lisp/elpa/difftastic-20251202.1715/difftastic.el")

(3) and how we can reproduce the issue.

Uninstall git, then byte-compile https://github.com/pkryger/difftastic.el.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions