microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.36k stars 28.92k forks source link

Source Control tab and Merge conflict detection #125413

Open nosjojo opened 3 years ago

nosjojo commented 3 years ago

My project's auto-generated code uses this structure for comment blocks (I think Labview/CVI generates it):

/*============================================================
Comment string
============================================================*/

This comment block is detected as a merge conflict flag by the Source Control tab - but the actual merge conflict resolution tool doesn't see it as a conflict.

Actual recreation of the issue just seems to require a file with that comment block be involved in a merge conflict. It looks like this on my end:

  1. Call git merge, get a merge conflict on the file. File is now shown in the "Merge Conflicts" group of Source Control.
  2. Open file, which now contains the merge conflict ======= tags for the break in individual merge conflicts.
  3. Resolve the conflicts. Editor window no longer shows any active merge conflicts.
  4. Select the "Add" button in Source Control to move the file to the "Staged Changes" group.

When the "Add" button is pressed, instead of the file being detected as resolved, the file is considered to still be under conflict resolution, and a popup is triggered asking "Are you sure you want to stage [filename] with merge conflicts?"

I was hoping this was getting fixed with the update included in https://github.com/microsoft/vscode/pull/116027 but appears to have gone live in 1.56.2 and this issue is still present.

I'm not super familiar with the language and codebase used in VSCode, but I'm guessing the issue stems from this line: https://github.com/microsoft/vscode/blob/c8d5c905bfdf6c78e84c6df501ff3ad2b79db006/extensions/git/src/commands.ts#L195 Which uses the regex pattern /^<{7}|^={7}|^>{7}/ to scan for unresolved conflicts. This likely needs to be /^<{7}|^={7}$|^>{7}/ or some other variation that locks the regex match to exactly 7 with no additional characters allowed.

Version: 1.56.2 (user setup) Commit: 054a9295330880ed74ceaedda236253b4f39a335 Date: 2021-05-12T17:13:13.157Z (3 wks ago) Electron: 12.0.4 Chrome: 89.0.4389.114 Node.js: 14.16.0 V8: 8.9.255.24-electron.0 OS: Windows_NT x64 10.0.18363

Running the following extensions: ms-vscode.cpptools eamodio.gitlens ms-vscode.hexeditor ms-toolsai.jupyter shd101wyy.markdown-preview-enhanced ms-python.vscode-pylance ms-python.python

All extensions are up-to-date as well.

vscodebot[bot] commented 3 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: