Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [egit-dev] I'm programmatically pushing but tracking branch doesnt get updated?

Hi Robin

I think the problem is that you are pushing directly to an URI (not a
named remote) and are not passing the fetch refspecs when calculating
RemoteRefUpdates for PushOperationSpecification.

createPushSpec is not included in the above code, so it's just a guess.

Look at what PushOperationUI does here:

https://git.eclipse.org/c/egit/egit.git/tree/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/push/PushOperationUI.java?id=1b6194a214bb518b47c4d8488353e36f4bcf2990#n178

Thanks for those hints!

yes you're completely right. I could solve the problem yesterday by looking into PushWizard. I cope the missing usage of fetchSpecs. Missing these made jgit/egit not update the remote tracking branches. This was clearly visible in the PushResult (update was empty with my code whereas when done via PushWizard the remote tracking branches were listed). Once I changed my code to match PushWizard the tracking branches were updated :)

The wroking code looks like this (matches what I've found in PushWizard:
<snip>
Collection<URIish> pushURIs = getPushURIs(remoteConfig); // get URI for named remote Collection<RefSpec> fetchRefSpecs = getFetchRefSpec(remoteConfig); // get fetchSpec for names remote Collection<RefSpec> pushRefSpecs = setForceUpdate(force, getPushRefSpecs(remoteConfig)); // evenutall set force-update PushOperationSpecification pushSpec = createPushSpec(pushURIs, pushRefSpecs, fetchRefSpecs, repository); PushOperation pushOperation = new PushOperation(repository, pushSpec, false, DEFAULT_TIMEOUT);
</snip>

Regards,
   Nibor



Back to the top