From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.bugs Subject: bug#29366: gitmerge to handle NEWS better Date: Mon, 11 Dec 2017 14:11:50 -0500 Message-ID: <6rpo7lnkp5.fsf@fencepost.gnu.org> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1513019530 2161 195.159.176.226 (11 Dec 2017 19:12:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 11 Dec 2017 19:12:10 +0000 (UTC) User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) Cc: monnier@iro.umontreal.ca, deng@randomsample.de To: 29366@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 11 20:12:06 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOTUk-0000Jt-LM for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Dec 2017 20:12:06 +0100 Original-Received: from localhost ([::1]:55086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOTUr-0000fv-Nd for geb-bug-gnu-emacs@m.gmane.org; Mon, 11 Dec 2017 14:12:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOTUm-0000do-7o for bug-gnu-emacs@gnu.org; Mon, 11 Dec 2017 14:12:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eOTUg-0000hK-KX for bug-gnu-emacs@gnu.org; Mon, 11 Dec 2017 14:12:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48536) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eOTUg-0000gf-GO for bug-gnu-emacs@gnu.org; Mon, 11 Dec 2017 14:12:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eOTUg-00036J-80 for bug-gnu-emacs@gnu.org; Mon, 11 Dec 2017 14:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Glenn Morris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Dec 2017 19:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29366 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29366-submit@debbugs.gnu.org id=B29366.151301951911908 (code B ref 29366); Mon, 11 Dec 2017 19:12:02 +0000 Original-Received: (at 29366) by debbugs.gnu.org; 11 Dec 2017 19:11:59 +0000 Original-Received: from localhost ([127.0.0.1]:57217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOTUc-000360-Nf for submit@debbugs.gnu.org; Mon, 11 Dec 2017 14:11:58 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:32768) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eOTUb-00035n-68 for 29366@debbugs.gnu.org; Mon, 11 Dec 2017 14:11:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eOTUU-0000K5-W2 for 29366@debbugs.gnu.org; Mon, 11 Dec 2017 14:11:51 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eOTUU-0000Jx-Rs; Mon, 11 Dec 2017 14:11:50 -0500 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1eOTUU-0001vh-Ek; Mon, 11 Dec 2017 14:11:50 -0500 X-Spook: Black out Zachawi government Kennedy undercover SEAL Team X-Ran: v`Hq@n:d'^I'lCw\u<=:]?e/?]&fq[;CeA3_ (Glenn Morris's message of "Mon, 20 Nov 2017 13:16:41 -0500") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:140939 Archived-At: 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.