cli/doctor: add git and git 2.28 check

Also:
+ Refactors hard dependency checks
+ Improve warnings for 26.x and 28.x users

Mentioned in #5088
This commit is contained in:
Henrik Lissner 2021-05-24 14:51:31 -04:00
parent 2d8342ca5f
commit 592116cece

View file

@ -50,14 +50,28 @@ in."
(print! (start "Checking your Emacs version..."))
(cond
(EMACS28+
(warn! (concat "Emacs %s detected. Doom should support this version, but be prepared for "
"Emacs updates causing breakages.")
(warn! (concat "Emacs %s detected. Doom support this version, but you are living on "
"edge! Be prepared for breakages in future versions of Emacs.")
emacs-version))
((= emacs-major-version 26)
(warn! (concat "Emacs %s detected. Doom is dropping Emacs 26.x support very soon. Consider "
"upgrading to Emacs 27.1.")
(warn! (concat "Emacs %s detected. Doom is dropping Emacs 26.x support in June 2021. "
"Consider upgrading to Emacs 27.1 (or better: 27.2) soon!")
emacs-version)))
(print! (start "Checking for Doom's prerequisites..."))
(print-group!
(if (not (executable-find "git"))
(error! "Couldn't find git on your machine! Doom's package manager won't work.")
(let ((version (cadr (split-string
(cdr (doom-call-process "git" "version"))
" version "))))
(when (version< version "2.28")
(error! "Git %s detected! Doom requires git 2.28 or newer!"
version))))
(unless (executable-find "rg")
(error! "Couldn't find the `rg' binary; this a hard dependecy for Doom, file searches may not work at all")))
(print! (start "Checking for Emacs config conflicts..."))
(when (file-exists-p "~/.emacs")
(warn! "Detected an ~/.emacs file, which may prevent Doom from loading")
@ -130,9 +144,6 @@ in."
file (/ size 1024 1024.0))
(explain! "Consider deleting it from your system (manually)"))))
(unless (executable-find "rg")
(error! "Couldn't find the `rg' binary; this a hard dependecy for Doom, file searches may not work at all"))
(unless (ignore-errors (executable-find doom-projectile-fd-binary))
(warn! "Couldn't find the `fd' binary; project file searches will be slightly slower"))