Skip to content

Building still fails if Git isn't installed/found #4640

@phst

Description

@phst

This is about building Magit from a fresh checkout in a CI environment where Git isn't available. To reproduce on GNU/Linux, you can e.g. make Git temporarily unavailable by bind-mounting it to a non-executable file:

make clean
bwrap --dev-bind / / --ro-bind /etc/hostname /usr/bin/git make lisp LOAD_PATH="-L . -L ../dash/ -L ../with-editor/lisp/"

Compiling the first few files will work, but then compiling magit-status will fail:

Compiling magit-status.el

In toplevel form:
magit-status.el:32:1: Error: Searching for program: Permission denied, git
make[1]: *** [Makefile:77: magit-status.elc] Error 1

I think the logic in

magit/lisp/magit.el

Lines 618 to 620 in 9fa3e49

;; Git isn't required while building Magit.
(cl-eval-when (load eval)
(magit-git-version-assert))
doesn't catch this case. (cl-eval-when (load eval) ...) will work as intended when magit.el is byte-compiled, but not when it's loaded as a dependency of some other file to be byte-compiled. This should probably be changed to something that tests whether byte-compilation is active at all, e.g. whether byte-compile-current-file is non-nil.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions