sublimehq / sublime_merge

Issue tracker for Sublime Merge
https://www.sublimemerge.com
276 stars 14 forks source link

Sublime merge won't stage file anymore #868

Open Gpinchon opened 4 years ago

Gpinchon commented 4 years ago

Version info

Description

I clicked on Stage while commiting previous changes and now Sublime Merge sees two files and I can't commit the file

Steps to reproduce

Steps to reproduce the behavior:

  1. Make change to a file
  2. Commit the changes
  3. While Sublime Merge is working on the commit, attempt to stage an other file

Expected behavior

Sublime Merge won't let you stage your changes on this file anymore (git bash won't work either), it can sometimes see the file two times with different cases

Screenshots

Before attempting to stage

When I try to stage src/Parser/OBJ.cpp (not src/parser/OBJ.cpp which does not exist) after staging

After commiting (I can't stage src/Parcer/OBJ.cpp) After commit

[EDIT] I could kind of fix this by deleting the file, commiting the change and adding it again, but now Sublime Merge has apparently decided that it's located under src/parser and not src/Parser

dpjohnst commented 4 years ago

Hi @Gpinchon,

Thank you for reporting this issue.

My gut instinct is that case sensitivity has been enabled for Windows, but core.ignorecase is set to true.

To help identify the problem, could you share the following:

Thanks, - Dylan

Gpinchon commented 4 years ago

Hi @dpjohnst, Your assumption is correct, core.ignorecase is set to true, but setting it to false doesn't fix the issue. Also, in debug log, it says that "Our config output is different to the Git config output" I am scanning for personnal informations before attaching the log. [EDIT] : Here, I think I got everything : Debug Informations

dpjohnst commented 4 years ago

Hi @Gpinchon,

Thanks for sharing the debug information!

We've just released Sublime Merge development build 2030. Before continuing further, could you update to this build and verify if this resolves the issue.

Additionally, could you confirm whether you can stage the file via the command line using plain Git.

Thanks, - Dylan

Gpinchon commented 4 years ago

Hello @dpjohnst, I just installed the new dev build, it does not fix the issue, now I can see both "src/parser/FBX.cpp" and "src/Parser/FBX.cpp" and whenever I try to stage the changes for "src/Parser/FBX.cpp" it stages "src/parser/FBX.cpp" instead... Small precision, the files located under "src/Parser" were located under "src/parser" before, but I changed the folder's case, but that was a long time ago. Same issue via Git Bash, seems like my history got "fooped up" by Sublime Merge...

Gpinchon commented 4 years ago

I made the repository public BTW, if that can help, it seems to be happening on a clean clone : https://github.com/Gpinchon/TabGraph.git

dpjohnst commented 4 years ago

Hi @Gpinchon,

Thank you for sharing this additional information!

I've cloned the repository, and managed to identify the issue.

Git relies on core.ignorecase being set appropriately, and in this case it looks like core.ignorecase is set to true in the repository config file. This causes Git to be unable to stage the file (as it cannot tell the difference between src/Parser/FBX.cpp and src/parser/FBX.cpp, and tries to stage the latter instead).

To resolve this issue, I was able to modify the config file in the repository (found under TabGraph\.git\config). In this file, I set ignorecase = false and the problem resolved itself.

Once you've set ignorecase to false, run the following command in the repository (via command line) to ensure it's been set correctly: git config core.ignorecase.

Once run, it should output false.

Once this has been set, you should be able to stage the file with Git (and also Sublime Merge).

As a bit of info, Sublime Merge never performs Git operations itself, and instead relies on Git to perform the operation. Often if you see any strange behavior with write operations (such as staging or unstaging), its likely a git configuration issue.

Let me know if this helps, and if not I can definitely investigate further. Thanks, - Dylan

dpjohnst commented 4 years ago

Testing further, I've noticed some strange behavior, likely resulting from the case-insensitivity on Windows.

I'd take a read of the following if you get a chance: https://www.hanselman.com/blog/GitIsCasesensitiveAndYourFilesystemMayNotBeWeirdFolderMergingOnWindows.aspx https://docs.microsoft.com/en-us/azure/devops/repos/git/case-sensitivity?view=azure-devops https://stackoverflow.com/questions/2528589/git-windows-case-sensitive-file-names-not-handled-properly

The recommended solution by most is to rename the files / folders in a case insensitive fashion if you're doing any Windows development.

Hope this helps!