Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge conflict warning when there are none #44106

ben-clayton opened this issue Feb 21, 2018 · 6 comments

Merge conflict warning when there are none #44106

ben-clayton opened this issue Feb 21, 2018 · 6 comments


Copy link

@ben-clayton ben-clayton commented Feb 21, 2018

Issue Type



  1. Rebase a Git branch on to another containing identical changes (but without the abiltiy for git to fast-forward).
  2. Use VS code to resolve the conflicts so that a file no longer contains any diffs.
  3. Observe that there are no conflict markers remaining in the file.
  4. Attempt to stage the file.
  5. Observe the Are you sure you want to stage XXX with merge conflicts? message.
  6. Click ok.
  7. Observe the file disappears from the source control list (as expected due to the no-delta change).

(5) Is unexpected.

I've also checked that the files do not contain any <<<, ===, >>> looking comments.

This happens more often than not, but I have seen it stage the file without warning before. I was unable to determine what was different with this situation.

Observed on Linux, macOS and Windows.

VS Code Info

VS Code version: Code 1.20.1 (f88bbf9, 2018-02-13T15:31:21.019Z)
OS version: Linux x64 4.13.0-32-generic

System Info
Item Value
CPUs Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz (12 x 3400)
Load (avg) 1, 2, 1
Memory (System) 15.60GB (9.40GB free)
Process Argv /usr/share/code/code --disable-extensions
Screen Reader no
VM 0%
Extensions disabled Reproduces without extensions
@vscodebot vscodebot bot added the git label Feb 21, 2018
Copy link

@ben-clayton ben-clayton commented Feb 21, 2018

To easily reproduce step 1 (tested on linux):

mkdir vscode-bug-repro
cd vscode-bug-repro

git init
git checkout -b branch-a
echo "Keep this line" > file.txt
git add file.txt
git commit -m "Stuff"

git checkout -b branch-b
echo "Delete this line" > file.txt 
git add file.txt
git commit --amend -m "Skip this change in merge"
git rebase branch-a

code .

For (2), resolve the merge conflicts so that file.txt just contains the single line Keep this line.

@joaomoreno joaomoreno added this to the Backlog milestone Feb 21, 2018
@joaomoreno joaomoreno added the bug label Feb 21, 2018
Copy link

@dkeulen dkeulen commented Mar 29, 2018

I also have the same issue unfortunately.
latest vscode (1.21.1 - 79b4.....20f1), windows 10.

Copy link

@johannao76 johannao76 commented Apr 11, 2018

Same here. When trying to stage files, VSCode claims there are conflicts when there are none.
Version 1.22.0
Commit 6b4d53c
Date 2018-04-05T17:27:42.363Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64
OS Windows 10

Copy link

@zhuowei zhuowei commented May 22, 2018

I'm looking into this issue: here's what I found so far.

The code that displays the error is in

I tested using the repro from the first comment above, and after executing, unresolvedConflicts contains one item: the text file with status Status.BOTH_ADDED. However, the code seems to only check whether files with the Status.BOTH_MODIFIED status had conflicts resolved.

I'm guessing that the fix would involve checking if files with Status.BOTH_ADDED also had their conflicts resolved.

zhuowei added a commit to zhuowei/vscode that referenced this issue May 22, 2018
The existing code only checked for conflict markers for files with BOTH_MODIFIED
status; files with BOTH_ADDED status were always detected as conflicting even after
conflicts are resolved.

This fixes microsoft#44106.
Copy link

@zhuowei zhuowei commented May 22, 2018

I made a pull request that checks for conflict resolutions in files marked BOTH_ADDED. @joaomoreno Is this OK? How should I make sure that I haven't caused any regressions? Should I add a testcase for this scenario?

@joaomoreno joaomoreno closed this in c0cfa06 Jul 6, 2018
@joaomoreno joaomoreno reopened this Jul 6, 2018
Copy link

@joaomoreno joaomoreno commented Jul 6, 2018

The original issue is different than the issue that the rest of the discussion talks about and the PR fixes. I pushed a fix for the original issue and will review the PR.

Original issue repro steps: have a conflict, resolve it and try to run Git: Stage All Changes.

Other issue repro steps: #44106 (comment)

@joaomoreno joaomoreno modified the milestones: Backlog, July 2018 Jul 6, 2018
@roblourens roblourens added the verified label Aug 2, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

6 participants