Subject: bug#20292: 24.5; Saving Git-controlled file with merge conflicts after "stash pop" stages the file

From: Dmitry Gutov <[email-masked]>
Date: Sat, 18 Apr 2015 22:16:51 +0300

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).

Should we be concerned about that?

> 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.

But what's the justification for vc-git-resolve-when-done?

I think vc-git-checkin will work well enough without that.

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?