Sourcetree has issues with repositories that have a redirected working directory using core.workdir. It seems for certain checks and actions Sourcetree is using the original working directory path instead of core.workdir.
- Create a new repository at "A:/repo/".
- Create a new file "test.txt", stage and commit it.
- Add "core.workdir=B:/workdir" to the git config. Sourcetree will report "test.txt" as deleted (which is expected behavior).
- Discard the change, change the file content and commit. This will work as expected as well.
- Now delete the file in the original working dir, "A:/repo/test.txt".
- Change its content again and try to stage the change via "Stage selected" or the file context menu. The file will be deleted in the working directory and staged as deleted instead of changed.
- Discard the deleted file. This will restore the file in the working dir, though the changes are gone.
- Create a new file in "B:/workdir/new.txt" with the content "Foo".
- Sourcetree will detect a new file, though is unable to display its content and will throw a "fatal: pathspec 'new.txt' did not match any files" error, when trying to stage it. Log output show Sourctree runs git rm, instead of git add.
- Now create a file in "A:/repo/new.txt" with the content "Bar". Sourcetree still shows a new file, though with the content "Bar". Adding/staging it will now work. After staging it, Sourcetree will display its correct content "Foo".
All actions above are working as expected, when using a terminal and git directly.