Requesting to disallow staging of files with unresolved conflicts. Or at least show a warning message if a user is trying to stage a file with unresolved conflicts.
This is a cool idea actually, want to attempt a PR?
It's not that simple.
There are various types of conflicts possible, for example for conflict of types: (deleted by them / deleted by us) staging the file (git add), is a way to resole the conflict and keep the file.
In that case, refusing to stage the file, will prevent the user from resolving the conflict, and force the user to use alternative GIT client, to resole the conflict.
In such cases we can show a warning with: add/rm options. Or maybe show X,V buttons in the sidebar? But then, we need to show an indication of what actually happend , and a way to undo the operation before the actual commit. And it get's complicated.
For example, let's take this git conflict:
In this state, doing: git rm foo && git status
Shows:
Changes to be committed:
deleted foo
And this has a nice indication in VSCode
But if instead, i would do: git add foo && git status (Or stage the file from within VSCode)
I would see in terminal:
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Without any indication of our actions, and no way to undo the action.
VSCode shows the git repository as clean, without the need to commit at all. (Probably another issue)
I would be happy to work on this issue, but i don't know in what direction this should go.
I see your concern. What I observe in VSCode when there is a 'deleted by them' conflict in the SCM viewlet under the 'Merge Changes', is that the file has a strike-through style. I find that there are 2 options:
In a 'deleted by us' scenario, the difference when compared from the scenario above is that when the '+' icon is clicked, it is indeed staged as an new file (Index added). So for the record, the only thing I see that needs to be fixed in a 'deleted by them' and 'deleted by us' scenario is the misleading tooltip message during a 'deleted by them' as mentioned above.
All other conflicts that contains conflict-markers (===, >>>, <<<) which are attempted to be added/staged should raise a warning as the OP suggested.
@joaomoreno this is my first try. Please review when you have the chance #30568. Thank you.
@BuraChuhadar @ferreus Let me introduce you guys to one another: #30568 #30529. 馃槅
Sadly, both of the PRs still couldn't pass CI. :(
Fixed by #30568
Most helpful comment
@BuraChuhadar @ferreus Let me introduce you guys to one another: #30568 #30529. 馃槅