]> git.eshelyaron.com Git - emacs.git/commitdiff
Stop assuming .git is a directory in gitmerge.el
authorNoam Postavsky <npostavs@gmail.com>
Tue, 12 Jun 2018 00:41:07 +0000 (20:41 -0400)
committerNoam Postavsky <npostavs@gmail.com>
Tue, 19 Jun 2018 00:02:04 +0000 (20:02 -0400)
* 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).

admin/gitmerge.el

index e676e8fa025521b3eadb4f73ad558406e12cbe58..a123e0352d735b5089c412f50c63cbf5bb3e48dd 100644 (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"))