From 7d5c6624e63a2554d62bc3c5ff7191087a16522e Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Thu, 23 Mar 2023 20:02:40 +0100 Subject: [PATCH] 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. --- site-lisp/db-eshell.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site-lisp/db-eshell.el b/site-lisp/db-eshell.el index 6cef0b4..d9dbfe2 100644 --- a/site-lisp/db-eshell.el +++ b/site-lisp/db-eshell.el @@ -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