fork-dev / TrackerWin

Bug and issue tracker for Fork for Windows
451 stars 10 forks source link

Discard submodule changes deletes new unstaged files #2103

Open bitsbakery opened 7 months ago

bitsbakery commented 7 months ago

Fork v1.92.0.0.

There is a repo R with a submodule S. S has some experimental changes and is on a detached HEAD. Among the changes, there is a new file, CMakeUserPresets.json, a new directory new_dir with a copy of CMakeUserPresets.json, and some other files have been modified. Neither CMakeUserPresets.json nor new_dir are staged. Switch to the main repo R, click "Local Changes". Among the changes, there is the submodule S marked as "M". Right-click S and in the context menu click "Discard submodule changes". The last action deletes CMakeUserPresets.json, but does not delete new_dir with its files.

I would like CMakeUserPresets.json to remain intact (the same way new_dir is) when clicking "Discard submodule changes" in the main repo. Imagine that this is a new configuration file that has just been added to the working copy, but not staged yet. When discarding submodule changes and then switching to other branch, I'd like to use the same config CMakeUserPresets.json for other branches. CMakeUserPresets.json is a good candidate for adding to .gitignore in S, but while that has not been done, it would be nice if Fork did not delete unstaged files.