Community
Participate
Working Groups
I find that if I open a file, make a change but do not save it to disk, then switch branches with egit, I get no prompt or reminder that my edit is incomplete, or that I may corrupt the equivalent file in the switched-to branch. Should it be possible to switch branches with unsaved editing changes?
see also my Bug 396757
*** Bug 394884 has been marked as a duplicate of this bug. ***
This is a major issue because the content from the branch is overwritten on save. If a file is changed and saved, then EGit already shows it in the 'Checkout Conflicts' dialog. Hence, the simplest solution here is to save the dirty files before starting to switch the branch. This will automatically result in the 'Checkout Conflicts' dialog where one can decide what to do.
That's one solution, though saving edits without the user actually agreeing to it is possibly a 'wrong thing in principle'. I'd like to retain control over whether an experimental edit I've done gets written back to the source file I took it from. I may not mean it to happen. You could alternatively simply pop-up "I'm not going to switch branches with dirty edits" and leave the user to pick the bones out of the situation for themselves. I'd prefer that.
Why not show the same dialog we show when the user selects Team > Commit... and has unsaved files: 'file' has been modified. Save changes? [No] [Cancel] [Yes] "Cancel" would abort the switch, "Yes" would save the file before switching. Only "No" would be a bit odd, it would have the same result as described in the description.
could do - but for myself I wouldn't give the user the option of carrying the edited file to the other branch - it can't have any reasonable meaning that I can think of.
This seems to be a more general issue: I just noticed today that the same silently happens while pulling changes. I would expect that the editor reports the conflict on save.
Fixed with: http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=7376e33bf89b9e24e5774ef009e8e03f133af2c4 http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=90646e23eaab9e5eb6abdf0f21f5bcb779d6bfd8 http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id= 59641820dd0c83265986c8ba8e2ba92ca56405c7
Verified with I20130128-2000 on Windows 7.