On branch checkout some files from current branch that do not belong to target branch stay (and marked unstaged)

Answered

Situation that became quite often after recent WebStorm update:

I am on `master` branch, which contains some files that are not on `dev` branch.

I checkout `dev` branch and some files from `master` that do not belong to `dev` stay in the tree and marked as not staged. However, other "disappear" as expected. I noticed that files created via IDE have normal behaviour while those added via OS (i.e. copied from some other location) tend to 'freeze' across branches.

Similar issue is described here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206066739-files-show-up-from-other-branch (dtd May 2013, not resolved).

When trying to checkout back to `master` IDE reports "Checkout failed" offering to remove untracked files before checking out. Sometimes this helps, other times throws an IOException.

However IDE behaves as expected in rare cases, which frustrates even more since should unproper behaviour be consistent I would look somewhere else.

I have switched off Workspace management feature. That haven't helped.

What is total nightmare, it seems that sometimes files do not get updated from git tree, which causes merger conflicts... Will try to reproduce and track this. Before today I thought something wrong happened to my git skills....

Anyone facing similar issue? Any suggestions will be appreciated. 

My environment:

WebStorm 2017.3
Build #WS-173.3727.108, built on November 25, 2017
JRE: 1.8.0_152-release-1024-b6 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 8.1 6.3

Situation is totally similar on my other computer under Windows 10.

1
2 comments

If you could reproduce this with some consistency, please submit an issue to https://youtrack.jetbrains.com/issues/IDEA

The description is not clear, however. IDE calls external git process to do checkouts, and e.g. the error on the screenshot is returned by git, not IDE. When the issue happens (e.g. as you say files are not updated in the tree), what does git status say on the command line?

1
Avatar
Permanently deleted user

Dmitriy, thank you for your comment.

That gave me an idea. In short, it is not IDE's fault. My apologies for the wrongful accusations.

How to reproduce in a project under git control:

  1. Install Markdown Navigator plugin https://plugins.jetbrains.com/plugin/7896-markdown-navigator
  2. Add an .md file with text content only and commit.
  3. Create and checkout some-branch.
  4. Checkout back to previous branch.
  5. Stage a big .gif file.
  6. Add a ![]() reference to the image in the .md file.
  7. Commit changes.
  8. Switch to the some-branch where .md file doesn't refer to the image.

Outcome:

  1. The .gif file name is marked red meaning it is not staged. IDE may recommend removing the file.
  2. Attempt to delete the file results in error message (see screenshot below). Attempt to delete the file by means of OS results in reporting that it cannot complete the action because the file is open by Webstorm.

It seems like the plugin causes IDE to lock the file and doesn't release it on checkout.

Should rather report the issue to the plugin author.

Native Jetbrains Markdown support plugin causes no issues as it shows only initial .gif frame, and therefore the file isn't locked.

 

0

Please sign in to leave a comment.