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" (--> "git status -s"
(shell-command-to-string it) (shell-command-to-string it)
(split-string it "\n" 'omit-nulls search-whitespace-regexp) (split-string it "\n" 'omit-nulls search-whitespace-regexp)
(--map (let ((parts (split-string it))) (if it
(cons (car parts) (cadr parts))) (--map (let ((parts (split-string it)))
it))) (cons (car parts) (cadr parts)))
it) nil)))
(branch (--> "git branch" (branch (--> "git branch"
(shell-command-to-string it) (shell-command-to-string it)
(split-string it "\n" 'omit-nulls search-whitespace-regexp) (split-string it "\n" 'omit-nulls search-whitespace-regexp)
(--filter (string-match-p (rx bol "* " (+ word)) it) it) (if it (progn
(split-string (car it)) (--filter (string-match-p (rx bol "* " (+ word)) it) it)
(cadr it))) (split-string (car it))
(cadr it))
"")))
(modcount (--> status-alist (modcount (--> status-alist
(--map (car it) it) (--map (car it) it)
(--count (string-match-p "M" it) it) (--count (string-match-p "M" it) it)