microsoft / vscode

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

Allow result path equal to base path in three-way merge #208295

Closed alexschlueter closed 6 months ago

alexschlueter commented 6 months ago

Does this issue occur when all extensions are disabled?: Yes

Version: 1.88.0-insider Commit: 09d5f4efc5089ce2fc5c8f6aeb51d728d7f4e758 Date: 2024-03-21T05:47:52.617Z Electron: 28.2.6 ElectronBuildId: 27476517 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Linux x64 5.15.0-100-generic

Steps to Reproduce:

  1. Run code CLI with merge command and pass a result path as last argument which is equal to the base path:
    code --merge file1.txt file2.txt base.txt base.txt

Instead of a three-way merge, the editor will open with all three files opened in normal view.

Why is this important?

The three-way merge view is very useful for some use cases where the base version is the one that should be modified as a result of the merge. One example: If file1 is generated from a base template, but the generated file was later modified resulting in file2, I want to update the base template in three-way merge to incorporate the changes. This allowed me to use vscode as merge editor for the chezmoi dotfiles manager.

This used to work in previous versions of vscode, but has stopped working for me after updating to 1.87.2.

hediet commented 6 months ago

This used to work in previous versions of vscode, but has stopped working for me after updating to 1.87.2.

I doubt this has worked.

The 3 way merge editor reacts to changes in base, so this cannot really work. I really recommend to copy base to temp, and use the temp file as actual base.

VSCodeTriageBot commented 6 months ago

We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding, and happy coding!