Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Doesn't always ask to replace editor contents
Doesn't always ask to replace editor contents [message #1861687] Fri, 27 October 2023 12:38 Go to next message
Eclipse UserFriend
EGit usually has a polite behavior where it asks if you want to replace the editor contents when checking out a different branch that edited that same file. It does this even when that file isn't marked as changed (*). The typical sequence is shown in Steps 1-4 in the image.

For some reason this warning sequence doesn't occur with all repos even though they have a similar file and branch structure. Instead, checking out a different branch that had a commit that contained that same file doesn't display the File Changed message box but immediately replaces the text view without marking that file as changed. This is the behavior I would normally expect.

What is the intended behavior and why isn't it the same for all repos? If you press the "Ignore file change" button, the "polite" sequence marks that file as being edited (*) and updates the contents in that view with the file in the other branch. This is a precursor to staging another commit which isn't so polite.

EGit 6.5.0.202303070854-r

index.php/fa/43639/0/
Re: Doesn't always ask to replace editor contents [message #1861688 is a reply to message #1861687] Fri, 27 October 2023 15:06 Go to previous messageGo to next message
Eclipse UserFriend
I think it's the editor raising this dialog when it recognises that the underlying file has been changed by the checkout.
The editor doesn't notice such changes if the file is not located under an imported Eclipse project.
Eclipse caches files in projects in its resource model, this model only includes files located inside of open Eclipse projects
which are imported in the Eclipse workspace.
Re: Doesn't always ask to replace editor contents [message #1861842 is a reply to message #1861688] Tue, 07 November 2023 17:56 Go to previous message
Eclipse UserFriend
You're right, repos that reported changes simply by checking out a different branch then clicking in the file view never had a .project file! These repos were created in GitHub then cloned into EGit. I was editing files directly from the Working Tree in the Git perspective and creating new files in that folder using Windows Explorer. I've since created an Eclipse project from that EGit repo using steps 1-7 below. The only odd thing is after importing in Step 5, the new ".project" file doesn't show in Unstaged Changes (Fig 7) until after I press F5 (refresh). It seems it should automatically do this after pressing "Finish" in Step 5.

Even with a .project file, I'm not sure which branch the file/edit view contents is showing. For example, you edit a file (but don't save) then checkout a different branch. This doesn't automatically update that view or display a dialog so you no longer know which branch that file was edited under. If you then click in that view it asks if you want to Ignore or Replace. If you select Ignore, is there a way to tell which branch that file view is showing? You can't assume it's the checked out branch.

index.php/fa/43683/0/
Previous Topic:multiple ssh keys
Next Topic:ssh password dialog on each git interaction since eclipse 2023-09
Goto Forum:
  


Current Time: Tue May 20 22:18:48 EDT 2025

Powered by FUDForum. Page generated in 0.03018 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top