Repository: vscode
Issue: mergetool conflict resolution auto applying combination as manual resolution
Labels: bug,merge-editor


Type: <b>Bug</b>

Somewhat recently (I’d guess in the last 1-2 weeks – I’ve been doing a lot of history rewriting lately), VSCode’s mergetool started auto applying what I think are combinations as manual resolutions.

Data prep:
- Create a simple PowerShell script file (other files likely work – I just noticed the problem with PowerShell)
- In the PowerShell script, create a function and call that function
- Add and commit the new file. I used the git cli.
- In the PowerShell script, create a second function and call that function, adding the new function call after the first
- Add and commit the change
- Start an interactive rebase
- Edit the first commit
- In the PowerShell script, add a parameter to the first (only) function
- In the PowerShell script, use the new parameter in the first function
- Commit this change by amending it to the first commit
- Continue the rebase
- You should get a merge conflict

Minimal-ish example:

- Open VSCode as a mergetool (I have it specified in my global git config)
  - The first confict doesn’t make sense to me. There seems to be a conflict between the changes to the body in first function (LOCAL) and the entire second function (REMOTE).
  - The second conflict is between the second function (REMOTE) and the lack of a second function (LOCAL). This one makes sense to me.
  - The third conflict is between the new parameter to the first function (LOCAL) and the call to the second function (REMOTE). This one also makes sense to me.
- In the result pane, the first conflict shows as manually resolved when I haven’t made any changes.
- Clicking accept combination for the second conflict on the REMOTE side duplicates the second function.

To help with the example, here’s what the code should end up looking like (I used kdiff to resolve the merge conflicts):

```
function Invoke-TestWrite {
    param(
        [string]$testParam
    )

    Write-Output "Hello, World!"
    Write-Output "Hello, $testParam!"
}

function Invoke-SecondFunction{
    Read-Host -Prompt "Hit enter to continue"
}

Invoke-TestWrite -testParam "VSCode"

Invoke-SecondFunction
```

VS Code version: Code 1.94.2 (384ff7382de624fb94dbaf6da11977bba1ecd427, 2024-10-09T16:08:44.566Z)
OS version: Windows_NT x64 10.0.22631
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i9-10900 CPU @ 2.80GHz (20 x 2808)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled<br>webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|31.72GB (8.39GB free)|
|Process Argv|. --crash-reporter-id c583746a-5e00-4137-9bf9-b978f05fe45c|
|Screen Reader|no|
|VM|50%|
</details><details><summary>Extensions (19)</summary>

Extension|Author (truncated)|Version
---|---|---
vscode-eslint|dba|3.0.10
gitlens|eam|15.6.0
EditorConfig|Edi|0.16.4
copilot|Git|1.238.0
copilot-chat|Git|0.21.1
csdevkit|ms-|1.11.14
csharp|ms-|2.50.25
vscode-dotnet-runtime|ms-|2.2.0
vscodeintellicode-csharp|ms-|2.1.11
cmake-tools|ms-|1.19.52
cpptools|ms-|1.21.6
cpptools-extension-pack|ms-|1.3.0
powershell|ms-|2024.2.2
psi-header|psi|1.23.1
markdown-preview-enhanced|shd|0.8.14
rewrap|stk|1.16.3
code-spell-checker|str|3.0.1
cmake|twx|0.0.17
material-theme|zhu|3.17.5

(2 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyonecf:30548226
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
724cj586:31013169
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
impr_priority:31102340
nativerepl1:31139838
refactort:31108082
pythonrstrctxt:31112756
wkspc-onlycs-t:31132770
nativeloc2:31134642
wkspc-ranged-t:31151552
cf971741:31144450
defaultse:31146405
iacca1:31156133
notype1cf:31151524
showchatpanel:31153267
5fd0e150:31155592

```

</details>

<!-- generated by issue reporter -->