Fix git status breaking in brand new repos with nil checks

This commit is contained in:
mir 2024-02-25 15:22:13 -09:00
parent f8d42c6828
commit 1502872174

15
p11k.el
View File

@ -236,15 +236,18 @@ Use 'window-width' to calculate the total final width."
(--> "git status -s"
(shell-command-to-string it)
(split-string it "\n" 'omit-nulls search-whitespace-regexp)
(--map (let ((parts (split-string it)))
(cons (car parts) (cadr parts)))
it)))
(if it
(--map (let ((parts (split-string it)))
(cons (car parts) (cadr parts)))
it) nil)))
(branch (--> "git branch"
(shell-command-to-string it)
(split-string it "\n" 'omit-nulls search-whitespace-regexp)
(--filter (string-match-p (rx bol "* " (+ word)) it) it)
(split-string (car it))
(cadr it)))
(if it (progn
(--filter (string-match-p (rx bol "* " (+ word)) it) it)
(split-string (car it))
(cadr it))
"")))
(modcount (--> status-alist
(--map (car it) it)
(--count (string-match-p "M" it) it)