[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29366: gitmerge to handle NEWS better

From: Glenn Morris
Subject: bug#29366: gitmerge to handle NEWS better
Date: Mon, 11 Dec 2017 14:11:50 -0500
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

Glenn Morris wrote:

> Currently etc/NEWS in the emacs-26 branch has been renamed to
> etc/NEWS.26 in master. Running M-x gitmerge, this is not detected.
> emacs-26:etc/NEWS changes are merged to master:etc/NEWS, resulting in a
> merge conflict every time NEWS is touched in emacs-26.
> Can gitmerge do something to help here?

I added some code for this in 0b6f4f2 that I thought worked.
There's pre-existing gitmerge code that uses smerge to try and
auto-resolve conflicts. I just added a special-case for NEWS at the same

However, it's missing a step that will automatically continue the merge
(ie, do the equivalent of running M-x gitmerge after manually fixing a
conflict). I cannot see how this would work for the "smerge fixed a
conflict automatically" case either. I don't know how to simulate an
smerge-fixable conflict to test.

Am I overlooking something, or is the code missing something like the

--- a/admin/gitmerge.el
+++ b/admin/gitmerge.el
@@ -431,7 +431,8 @@ gitmerge-resolve-unmerged
              (setq conflicted t)
            ;; Mark as resolved
            (call-process "git" nil t nil "add" file)))
-       (when conflicted
+       (if (not conflicted)
+           (if files (gitmerge-maybe-resume 'noask))
          (with-current-buffer (get-buffer-create gitmerge-warning-buffer)
            (insert "For the following files, conflicts could\n"
@@ -457,7 +458,7 @@ gitmerge-repo-clean
                    "diff" "--name-only")
       (zerop (buffer-size))))
-(defun gitmerge-maybe-resume ()
+(defun gitmerge-maybe-resume (&optional noask)
   "Check if we have to resume a merge.
 If so, add no longer conflicted files and commit."
   (let ((mergehead (file-exists-p
@@ -469,7 +470,7 @@ gitmerge-maybe-resume
               (not (gitmerge-repo-clean)))
       (user-error "Repository is not clean"))
     (when statusexist
-      (if (not (y-or-n-p "Resume merge? "))
+      (if (not (or noask (y-or-n-p "Resume merge? ")))
            (delete-file gitmerge-status-file)
            ;; No resume.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]