Bug 551243 - FETCH_HEAD isn't updated in the git history
Summary: FETCH_HEAD isn't updated in the git history
Status: NEW
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 5.5   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 551245
  Show dependency tree
 
Reported: 2019-09-19 08:15 EDT by Thomas Wolf CLA
Modified: 2019-11-04 07:16 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wolf CLA 2019-09-19 08:15:02 EDT
This was fixed for one case (fetch from Gerrit) in bug 437362.

But in the general case this apparently never worked. Just do a "Fetch from upstream" and observe FETCH_HEAD staying put even if there are new refs.

The underlying reason is that JGit doesn't send an event when updating FETCH_HEAD. If branches are updated, EGit does get a RefsChangedEvent, but that is sent before FETCH_HEAD is updated.

Should we make JGit fire a new FetchHeadChangedEvent that EGit could listen to? Then the GitHistoryPage could update properly.
Comment 1 Matthias Sohn CLA 2019-11-03 17:49:13 EST
(In reply to Thomas Wolf from comment #0)
> This was fixed for one case (fetch from Gerrit) in bug 437362.
> 
> But in the general case this apparently never worked. Just do a "Fetch from
> upstream" and observe FETCH_HEAD staying put even if there are new refs.
> 
> The underlying reason is that JGit doesn't send an event when updating
> FETCH_HEAD. If branches are updated, EGit does get a RefsChangedEvent, but
> that is sent before FETCH_HEAD is updated.
> 
> Should we make JGit fire a new FetchHeadChangedEvent that EGit could listen
> to? Then the GitHistoryPage could update properly.

+1 for adding an event fired when FETCH_HEAD changed

Do we need another event for ORIG_HEAD ?
Comment 2 Thomas Wolf CLA 2019-11-04 07:16:50 EST
Didn't notice such problems with ORIG_HEAD; presumably because it'll be set _before_ changes occur, so EGit will pick it up automatically on a RefsChanged/IndexDiffChanged event?

I'm not 100% sure a new event is right, though. Perhaps the reason for it not existing (yet) is that the assumption was that FETCH_HEAD changes only on fetch/pull, and any user of JGit knows when it invokes a fetch/pull and thus knows whether or not it should update anything... Which means EGit would, like it does for "Fetch from Gerrit", fire its own event whenever it did a fetch.

Not sure what's better.