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:
parent
584480bd53
commit
437ce6daff
|
@ -77,10 +77,10 @@ git repository."
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(let* ((git-branch (string-trim
|
(let* ((git-branch (string-trim
|
||||||
(shell-command-to-string "git rev-parse --abbrev-ref HEAD")))
|
(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
|
(state-list (cl-remove-if #'null
|
||||||
(list
|
(list
|
||||||
(when (file-exists-p (file-name-concat "." ".git" "MERGE_HEAD"))
|
(when (file-exists-p (file-name-concat repo-dir ".git" "MERGE_HEAD"))
|
||||||
"merge")
|
"merge")
|
||||||
(when (= 1 (call-process "git" nil nil nil
|
(when (= 1 (call-process "git" nil nil nil
|
||||||
"diff" "--no-ext-diff" "--quiet" "--exit-code"))
|
"diff" "--no-ext-diff" "--quiet" "--exit-code"))
|
||||||
|
|
Loading…
Reference in New Issue