unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: 29366@debbugs.gnu.org
Cc: monnier@iro.umontreal.ca, deng@randomsample.de
Subject: bug#29366: gitmerge to handle NEWS better
Date: Mon, 11 Dec 2017 14:11:50 -0500	[thread overview]
Message-ID: <6rpo7lnkp5.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <a9wp2k24ty.fsf@fencepost.gnu.org> (Glenn Morris's message of "Mon, 20 Nov 2017 13:16:41 -0500")

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
place.

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
following:

--- 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)
 	    (erase-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? ")))
 	  (progn
 	    (delete-file gitmerge-status-file)
 	    ;; No resume.







  reply	other threads:[~2017-12-11 19:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20 18:16 bug#29366: gitmerge to handle NEWS better Glenn Morris
2017-12-11 19:11 ` Glenn Morris [this message]
2017-12-11 23:18   ` David Engster
2017-12-11 23:33     ` Glenn Morris
2017-12-12 20:10       ` David Engster
2017-12-13  3:06         ` Glenn Morris
2018-10-23 17:10           ` Glenn Morris
2018-10-23 17:23             ` Eli Zaretskii
2018-10-23 17:35               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6rpo7lnkp5.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=29366@debbugs.gnu.org \
    --cc=deng@randomsample.de \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).