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

Closed
ben-clayton opened this issue Feb 21, 2018 · 6 comments · Fixed by #50252
Closed

Merge conflict warning when there are none #44106

ben-clayton opened this issue Feb 21, 2018 · 6 comments · Fixed by #50252
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues help wanted Issues identified as good community contribution opportunities verified Verification succeeded
Milestone

Comments

@ben-clayton
Copy link

ben-clayton commented Feb 21, 2018

Issue Type

Bug

Description

  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 GIT issues label Feb 21, 2018
@ben-clayton
Copy link
Author

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 Issue identified by VS Code Team member as probable bug label Feb 21, 2018
@dkeulen
Copy link

dkeulen commented Mar 29, 2018

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

@joaomoreno joaomoreno added the help wanted Issues identified as good community contribution opportunities label Apr 3, 2018
@johannao76
Copy link

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

@zhuowei
Copy link
Contributor

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

https://github.com/Microsoft/vscode/blob/d1380912cf5c9db73d35ba00c5028f021a8f897e/extensions/git/src/commands.ts#L636

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.
@zhuowei
Copy link
Contributor

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 reopened this Jul 6, 2018
@joaomoreno
Copy link
Member

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 Verification succeeded 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.
Labels
bug Issue identified by VS Code Team member as probable bug git GIT issues help wanted Issues identified as good community contribution opportunities verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants