emacscollective / borg

Assimilate Emacs packages as Git submodules
https://emacsmirror.net/manual/borg
GNU General Public License v3.0
255 stars 28 forks source link

`borg-drones` malfunctions if Magit is not loaded #132

Closed zyxir closed 1 year ago

zyxir commented 1 year ago

The Problem

When borg-remove is called before Magit is loaded, an error will occur:

Debugger entered--Lisp error: (void-function magit-git-version)
  magit-git-version()
  borg-drones()
  (progn (borg-drones))

I manage all my packages with Borg. In my opinion, Borg should work properly without Magit.

Reproduce

Make sure that Borg is installed in ~/.emacs.d/lib/borg. Launch Emacs with emacs -Q, and evaluate the code below:

(add-to-list 'load-path
             (expand-file-name "lib/borg" user-emacs-directory))
(require 'borg)
(borg-drones)

Analysis

This problem is caused by borg-drones explicitly calling magit-git-version without checking if Magit is available.

My workaround is to add an :before advice to borg-remove, where Magit is required explicitly. However, I expect Borg to work without such workarounds.

I think there should be alternative ways to get the Git version, without the help of Magit.

tarsius commented 1 year ago

I've already fixed that pasto in the latest commit, but you might have to update borg manually.

zyxir commented 1 year ago

you might have to update borg manually.

Just did it. It fixed the issue. Thanks!