[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20292: 24.5; Saving Git-controlled file with merge conflicts after "

From: Eli Zaretskii
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

> Date: Sat, 18 Apr 2015 22:16:51 +0300
> From: Dmitry Gutov <address@hidden>
> CC: "Eric S. Raymond" <address@hidden>
> 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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]