`git-commit': fix variable predicates

`git-commit-summary-max-length' should be a number, not a symbol.

`git-commit-major-mode' should be checked more carefully, as otherwise
exploits are possible (e.g. if it is `erase-buffer' or some more
dangerous function of the user's environment).
This commit is contained in:
Nikita Bloshchanevich 2021-03-07 18:18:50 +01:00
parent 2ab8800bb4
commit 973f23b1df

View file

@ -9,8 +9,11 @@
(setenv "GIT_ASKPASS" "git-gui--askpass")) (setenv "GIT_ASKPASS" "git-gui--askpass"))
;; Don't complain when these variables are set in file/local vars ;; Don't complain when these variables are set in file/local vars
(put 'git-commit-major-mode 'safe-local-variable 'symbolp) (put 'git-commit-major-mode 'safe-local-variable
(put 'git-commit-summary-max-length 'safe-local-variable 'symbolp) (lambda (x)
(memq x '(git-commit-elisp-text-mode
text-mode fundamental-mode org-mode markdown-mode))))
(put 'git-commit-summary-max-length 'safe-local-variable 'numberp)
;; In case the user is using `bug-reference-mode' ;; In case the user is using `bug-reference-mode'
(map! :when (fboundp 'bug-reference-mode) (map! :when (fboundp 'bug-reference-mode)