Control: forwarded -1 https://github.com/magit/magit/pull/5280

Hi Timon, Charles,

Charles Curley <charlescur...@charlescurley.com> writes:

> On Fri, 20 Dec 2024 15:23:40 +0100 Timon Reinold <tirei+...@agon.one>
> wrote:
>> Package: elpa-magit
>> Version: 4.1.3-1
>> Severity: normal
>> Tags: upstream
>> 
>> Dear Maintainer,
>> 
>> 
>> After loading git-commit.el without loading magit.el,
>> `git-commit-setup' fails. To reproduce, try:
>> 
>>     $ emacs -q --eval="(require 'git-commit)" \
>>             COMMIT_EDITMSG
>> 
>> Note the error message in the echo area "Symbol's function definition
>> is void: magit-process-git", and that the Emacs frame is not
>> displaying the COMMIT_EDITMSG buffer.  After switching to the
>> COMMIT_EDITMSG buffer, observe that it is in `fundamental-mode'.
>> Compare that to:
>> 
>>     $ emacs -q --eval="(progn (require 'git-commit) (require
>> 'magit-process))" \ COMMIT_EDITMSG
>> 
>> Now, the Emacs frame displays the COMMIT_EDITMSG buffer in
>> `text-mode' with all the niceties of `git-commit-setup' activated
>> (observe e.g. the different fontification of the first (summary),
>> second (empty) and third (body) line).
>> 
>> The failure occurs as `git-commit-setup' invokes `magit-toplevel',
>> which invokes `magit-rev-parse-safe', which invokes `magit-git-str',
>> which invokes `magit-process-git', which is defined in
>> magit-process.el which has at no point been loaded.
>> There should probably be a "(require 'magit-process)" in one of these
>> files (maybe within the `git-commit-setup' function itself, to keep
>> load times of the non-autoloadable git-commit.el short), or an
>> `autoload' annotation on `magit-process-git'.
>> 
>> 
>> The documentation for `global-git-commit-mode' states:
>> 
>>     You can either rely on `magit' loading this library or
>>     you can load it explicitly.
>> 
>> So loading git-commit.el without loading magit.el (which would load
>> magit-process.el) should be supported.  My usecase for that is using
>> the features provided by `git-commit-setup' when the Git CLI invokes
>> Emacs (or Emacsclient) as its $EDITOR.  For that I have only
>> "(require 'git-commit)" in my init.el, while the rest of Magit is
>> autoloaded only when it's actually used.
>> 
>> 
>> I'm reporting this to the debian package instead of upstream, as I
>> think this occurs since about the time the elpa-magit and
>> elpa-git-commit packages were merged.  I do think it's just an
>> upstream bug, but am not 100 % sure.
>> 
>> 
>> 
>> Yours
>> Timon
>> 
>> 
>> 
>
> I am seeing a similar issue, perhaps the same issue from a different
> view. On trixie (elpa-magit 4.1.3-1) I went to commit a change, and got:
>
> charles@tiassa:~/versioned/emutosdocs$ git commit README.md 
> hint: Waiting for your editor to close the file... Waiting for Emacs...
> *ERROR*: Symbol’s function definition is void: magit-process-git
> error: there was a problem with the editor 'emacsclient'
> Please supply the message using either -m or -F option.
> charles@tiassa:~/versioned/emutosdocs$
>
> -- 
> Does anybody read signatures any more?
>
> https://charlescurley.com
> https://charlescurley.com/blog/
>

I managed to reproduced the issue using Timon's command.  I have also
made a upstream PR with a proposed fix at [1].

[1] https://github.com/magit/magit/pull/5280

-- 
Regards,
Xiyue Deng

Attachment: signature.asc
Description: PGP signature

Reply via email to