From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#20292: 24.5; Saving Git-controlled file with merge conflicts after "stash pop" stages the file Date: Sat, 18 Apr 2015 22:31:41 +0300 Message-ID: <834mod6xnm.fsf@gnu.org> References: <83fv88ta5r.fsf@gnu.org> <5532ADA3.5000006@yandex.ru> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1429385601 19219 80.91.229.3 (18 Apr 2015 19:33:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Apr 2015 19:33:21 +0000 (UTC) Cc: esr@snark.thyrsus.com, 20292@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 18 21:33:11 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YjYUI-00034r-Rd for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Apr 2015 21:33:11 +0200 Original-Received: from localhost ([::1]:46669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjYUH-0008TD-UY for geb-bug-gnu-emacs@m.gmane.org; Sat, 18 Apr 2015 15:33:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjYUF-0008T2-Jb for bug-gnu-emacs@gnu.org; Sat, 18 Apr 2015 15:33:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YjYUB-00065U-Hw for bug-gnu-emacs@gnu.org; Sat, 18 Apr 2015 15:33:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42193) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YjYUB-00065G-F2 for bug-gnu-emacs@gnu.org; Sat, 18 Apr 2015 15:33:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YjYUA-0007N0-My for bug-gnu-emacs@gnu.org; Sat, 18 Apr 2015 15:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Apr 2015 19:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20292 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20292-submit@debbugs.gnu.org id=B20292.142938552528244 (code B ref 20292); Sat, 18 Apr 2015 19:33:02 +0000 Original-Received: (at 20292) by debbugs.gnu.org; 18 Apr 2015 19:32:05 +0000 Original-Received: from localhost ([127.0.0.1]:60202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YjYTF-0007LS-1Z for submit@debbugs.gnu.org; Sat, 18 Apr 2015 15:32:05 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:59684) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YjYTA-0007KJ-Bw for 20292@debbugs.gnu.org; Sat, 18 Apr 2015 15:32:02 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0NN000400OKGVZ00@a-mtaout23.012.net.il> for 20292@debbugs.gnu.org; Sat, 18 Apr 2015 22:31:53 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NN00045YOX4T850@a-mtaout23.012.net.il>; Sat, 18 Apr 2015 22:31:53 +0300 (IDT) In-reply-to: <5532ADA3.5000006@yandex.ru> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:101688 Archived-At: > Date: Sat, 18 Apr 2015 22:16:51 +0300 > From: Dmitry Gutov > CC: "Eric S. Raymond" > > On 04/10/2015 03:55 PM, Eli Zaretskii wrote: > > > If "git stash pop" encounters merge conflicts, then resolving these > > conflicts in Emacs and saving the buffer will run "git add" for the > > file whose conflicts were resolved. But that is not TRT in this case; > > the user likely does not expect to have her uncommitted changes staged > > for the next commit. > > Apparently, to both mark the conflict as resolved and not stage the > file, the best we can do is 'git add ...; git reset ...', which would > not DTRT if the file had some changes, and they were staged before you > did 'git stash pop' (if the file had unstaged changes, 'git stash pop' > would abort). It's best not to run "git add" in the first place in this case. > > Therefore, I think vc-git-resolve-when-done should not run "git add" > > if the merge conflict was due to "git stash pop". > > Maybe we can detect this case (as well as any similar ones) by the > absence of .git/MERGE_HEAD. Why not detect that the conflict was from stashed changes? This is clearly stated at the last conflict marker. The find-file-hook could detect that and record the information. > But what's the justification for vc-git-resolve-when-done? So that "git commit" would "just work", I presume. > I think vc-git-checkin will work well enough without that. That would mean VC behaves wit Git differently than it does with other VCSes (bzr, at least). > Further, if there's a conflict, 'git stash pop' doesn't actually remove > the stash from the list. Would we expect vc-git-resolve-when-done to > call 'git stash drop' at the end of conflict resolution? Yes. Although IME, Git itself does that when you resolve the last conflict. But I'm not going to claim that this is 100% accurate, just that it happened to me when I needed to resolve conflicts from stash.