From 437ce6daffaca76ae1b614f561ff584546ce0113 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Tue, 30 Aug 2022 18:51:29 +0200 Subject: [PATCH] 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. --- 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 e96738a..f8b426a 100644 --- a/site-lisp/db-eshell.el +++ b/site-lisp/db-eshell.el @@ -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"))