From: Glenn Morris <rgm@gnu.org>
To: David Engster <deng@randomsample.de>
Cc: 29366@debbugs.gnu.org, monnier@iro.umontreal.ca
Subject: bug#29366: gitmerge to handle NEWS better
Date: Mon, 11 Dec 2017 18:33:32 -0500 [thread overview]
Message-ID: <0gbmj4et6b.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <87fu8g26ra.fsf@engster.org> (David Engster's message of "Tue, 12 Dec 2017 00:18:33 +0100")
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")))
(unwind-protect
@@ -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)
(erase-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
(gitmerge-resolve-unmerged)
;; 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.
t))))
next prev parent reply other threads:[~2017-12-11 23:33 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
2017-12-11 23:18 ` David Engster
2017-12-11 23:33 ` Glenn Morris [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0gbmj4et6b.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.