Fix errors in eshell prompt function

To determine whether a merge is in progress, do not check in the current
directory for .git/MERGE_HEAD, but do this in the repository directory.

When computing `base-dir`, take the whole non-directory part, not just the
basename; otherwise directories like .emacs.d will get the final `.d` get
stripped off.
This commit is contained in:
Daniel - 2022-08-30 18:51:29 +02:00
parent 584480bd53
commit 437ce6daff
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 2 additions and 2 deletions

View File

@ -77,10 +77,10 @@ git repository."
(save-match-data
(let* ((git-branch (string-trim
(shell-command-to-string "git rev-parse --abbrev-ref HEAD")))
(base-dir (file-name-base (string-trim-right repo-dir "/?")))
(base-dir (file-name-nondirectory (string-trim-right repo-dir "/?")))
(state-list (cl-remove-if #'null
(list
(when (file-exists-p (file-name-concat "." ".git" "MERGE_HEAD"))
(when (file-exists-p (file-name-concat repo-dir ".git" "MERGE_HEAD"))
"merge")
(when (= 1 (call-process "git" nil nil nil
"diff" "--no-ext-diff" "--quiet" "--exit-code"))