[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 18:33:32 -0500
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

David Engster wrote:

> I'm not sure about that smerge stuff either, that was something I took
> over from bzrmerge. It may be that it is not functional. I hope I can
> make time to take a look at this in the coming days.

Thanks! Here's my revised patch for this. It just does a commit after a
successful auto-conflict resolution. It seems to work...

--- a/admin/gitmerge.el
+++ b/admin/gitmerge.el
@@ -316,11 +316,7 @@ gitmerge-resolve
                                    (gitmerge-emacs-version gitmerge--from))))
                    (file-exists-p temp)
                    (or noninteractive
-                       (and
-                        (y-or-n-p "Try to fix NEWS conflict? ")
-                        ;; FIXME
-                        (y-or-n-p "This is buggy, really try? ")
-                        )))
+                       (y-or-n-p "Try to fix NEWS conflict? ")))
               (let ((relfile (file-name-nondirectory file))
                     (tempfile (make-temp-file "gitmerge")))
@@ -431,7 +427,9 @@ gitmerge-resolve-unmerged
              (setq conflicted t)
            ;; Mark as resolved
            (call-process "git" nil t nil "add" file)))
-       (when conflicted
+       (if (not conflicted)
+           (and files (not (gitmerge-commit))
+                (error "Error committing resolution - fix it manually"))
          (with-current-buffer (get-buffer-create gitmerge-warning-buffer)
            (insert "For the following files, conflicts could\n"
@@ -457,6 +455,12 @@ gitmerge-repo-clean
                    "diff" "--name-only")
       (zerop (buffer-size))))
+(defun gitmerge-commit ()
+  "Commit, and return non-nil if it succeeds."
+  (with-current-buffer (get-buffer-create gitmerge-output-buffer)
+    (erase-buffer)
+    (eq 0 (call-process "git" nil t nil "commit" "--no-edit"))))
 (defun gitmerge-maybe-resume ()
   "Check if we have to resume a merge.
 If so, add no longer conflicted files and commit."
@@ -478,11 +482,8 @@ gitmerge-maybe-resume
        ;; Commit the merge.
        (when mergehead
-         (with-current-buffer (get-buffer-create gitmerge-output-buffer)
-           (erase-buffer)
-           (unless (zerop (call-process "git" nil t nil
-                                        "commit" "--no-edit"))
-             (error "Git error during merge - fix it manually"))))
+         (or (gitmerge-commit)
+             (error "Git error during merge - fix it manually")))
        ;; Successfully resumed.

reply via email to

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