GNU bug report logs -
#20292
24.5; Saving Git-controlled file with merge conflicts after "stash pop" stages the file
Previous Next
Reported by: Eli Zaretskii <eliz <at> gnu.org>
Date: Fri, 10 Apr 2015 12:57:02 UTC
Severity: normal
Merged with 20151
Found in versions 24.5, 25.0.50
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
Message #13 received at 20292 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 18 Apr 2015 22:16:51 +0300
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> CC: "Eric S. Raymond" <esr <at> snark.thyrsus.com>
>
> 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.
This bug report was last modified 8 years and 191 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.