Improve eshell git prompt check for ongoing merges

Checking for filenames is fragile if gitdir files are being used (as is common
for submodules).  Better try to resolve MERGE_HEAD via git.
This commit is contained in:
Daniel - 2023-03-23 20:02:40 +01:00
parent 6bac3973f9
commit 7d5c6624e6
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625
1 changed files with 2 additions and 2 deletions

View File

@ -105,8 +105,8 @@ git repository."
(when (and db/eshell-prompt-include-git-state
has-HEAD)
;; XXX: This does not work in repositories with gitdir files
(when (file-exists-p (file-name-concat repo-dir ".git" "MERGE_HEAD"))
(when (zerop (call-process "git" nil nil nil "rev-parse" "MERGE_HEAD"))
;; MERGE_HEAD exists, so we are in a merge
(push "merge" state-list))
(when (= 1 (call-process "git" nil nil nil