1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-15 17:00:26 +00:00

Stop assuming .git is a directory in gitmerge.el

* admin/gitmerge.el (gitmerge-maybe-resume): Use 'git rev-parse
--git-dir' to find the git directory rather than assuming it is
.git/ (that assumption fails for separated worktrees).
This commit is contained in:
Noam Postavsky 2018-06-11 20:41:07 -04:00
parent 91ebbbfa10
commit 5498acb5a2

View File

@ -483,8 +483,12 @@ Throw an user-error if we cannot resolve automatically."
(defun gitmerge-maybe-resume ()
"Check if we have to resume a merge.
If so, add no longer conflicted files and commit."
(let ((mergehead (file-exists-p
(expand-file-name ".git/MERGE_HEAD" default-directory)))
(let ((mergehead
(file-exists-p
(expand-file-name
"MERGE_HEAD"
(car (process-lines
"git" "rev-parse" "--no-flags" "--git-dir")))))
(statusexist (file-exists-p gitmerge-status-file)))
(when (and mergehead (not statusexist))
(user-error "Unfinished merge, but no record of a previous gitmerge run"))