Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Tracking the deletion of remote branches?
Tracking the deletion of remote branches? [message #1743027] Fri, 09 September 2016 16:22 Go to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1527
Registered: July 2009
Senior Member
I just noticed that EGit still shows as "remote tracking" a branch that recently got deleted on the remote - even after pull. Is EGit supposed to (automatically) remove the remote tracking branch on pull, or is there a specific gesture to achieve this?

FWIW, Collect Garbage didn't do the job, either.

Not sure if this is a (intentionally?) missing feature, or a bug or a PEBKAC?

thanks,
Stephan
Re: Tracking the deletion of remote branches? [message #1743092 is a reply to message #1743027] Mon, 12 September 2016 07:37 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 241
Registered: July 2009
Senior Member
I guess this is a missing feature in EGit/JGit that we don't clean up remote tracking branches. What I can say is that the garbage collection can't repair that situation. Garbage collection is a pure local-only operation. When GC is running and there are some remote tracking branches the GC does not know whether the corresponding branches on the remote git server still exist or not. And GC is not asking all the configured remotes for the complete list of refs. I think it should be a feature of the fetch operation (that operation which is responsible to modify the remote tracking branches) to delete local remote tracking branches if the corresponding branch on the remote server does not exist anymore. It could be a little bit tricky if you fetch like "git fetch origin features/abc/12*". You would first have to find out which remote tracking branches exist locally and match that pattern, compare that with the response from the server and delete those remote tracking branches which lost their counterpart.

Ciao
Chris
Re: Tracking the deletion of remote branches? [message #1743117 is a reply to message #1743092] Mon, 12 September 2016 11:09 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 962
Registered: July 2009
Senior Member
I think the basic work has already been done, FetchCommand.setRemoveDeletedRefs() could be used to implement git fetch -p.
This option is already avaible in JGit's CLI fetch command.
Re: Tracking the deletion of remote branches? [message #1743487 is a reply to message #1743117] Thu, 15 September 2016 20:42 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1527
Registered: July 2009
Senior Member
I was about to file a bug for this but then found https://bugs.eclipse.org/338054 Smile
I'm still to try this.
Maybe this should just be advertised in the UI somehow?
Re: Tracking the deletion of remote branches? [message #1744386 is a reply to message #1743487] Mon, 26 September 2016 12:46 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 962
Registered: July 2009
Senior Member
I forgot about this fix
Re: Tracking the deletion of remote branches? [message #1744433 is a reply to message #1744386] Mon, 26 September 2016 21:51 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1527
Registered: July 2009
Senior Member
Matthias Sohn wrote on Mon, 26 September 2016 14:46
I forgot about this fix


So, what do you think about making this discoverable in the UI?
Re: Tracking the deletion of remote branches? [message #1752363 is a reply to message #1743117] Mon, 23 January 2017 03:58 Go to previous messageGo to next message
Velly Zhou is currently offline Velly ZhouFriend
Messages: 1
Registered: January 2017
Junior Member
Embarrassed Yes, FetchCommand could use method setRemoveDeletedRefs to set delete remote refercense . But the local tracking branch are still left there.
If anybody want to update local branch, they should manage it by themselves, I think.
Re: Tracking the deletion of remote branches? [message #1752753 is a reply to message #1744433] Thu, 26 January 2017 21:21 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 962
Registered: July 2009
Senior Member
+1 for making this discoverable from the UI

In addition we could add a UI option to set this on the fly for a single fetch call
Previous Topic:contents of ~/.gitignore not used
Next Topic:Git not available for an imported CMake project
Goto Forum:
  


Current Time: Wed Nov 22 20:32:29 GMT 2017

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

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