From de68fc30b244af7e3a4a7c4adc957fd452b1deab Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 8 Jun 2024 09:24:02 +0200 Subject: [PATCH] Statically specify git repositories for magit Relying on projectile's project list seems to be fragile and often includes too many repositories, so let's let magit find those repositories itself. --- init.el | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/init.el b/init.el index a6aa6c6..74a431b 100644 --- a/init.el +++ b/init.el @@ -1413,12 +1413,13 @@ Note that this workaround is incomplete, as explained in this comment." (use-package magit :ensure t :commands (magit-status - magit-list-repositories - db/sync-magit-repos-from-projectile) + magit-list-repositories) :init (progn (setq magit-diff-refine-hunk nil - magit-commit-show-diff nil) + magit-commit-show-diff nil + magit-repository-directories '(("~/" . 0) + ("~/Documents/" . 3))) (when on-windows ;; Experimental: on Windows, do not refresh magit-status-buffers @@ -1428,20 +1429,7 @@ Note that this workaround is incomplete, as explained in this comment." :config (progn (when (fboundp 'global-magit-file-mode) (global-magit-file-mode -1)) - (global-git-commit-mode 1) - - (defun db/sync-magit-repos-from-projectile () - "Update repositories known to magit from projectile's." - (interactive) - (eval-when-compile ; to silence the byte compiler - (require 'projectile)) - (setq magit-repository-directories - (->> projectile-known-projects - (--filter (and (not (file-remote-p it)) - (file-exists-p (concat it "/.git")))) - (--map (cons it 0))))) - - (db/sync-magit-repos-from-projectile))) + (global-git-commit-mode 1))) (use-package page-break-lines :pin "melpa-stable"