pub struct Prepare<'remote, 'repo, T, P>where
T: Transport,{ /* private fields */ }
blocking-network-client
and (crate features async-network-client
or blocking-network-client
) only.Expand description
A structure to hold the result of the handshake with the remote and configure the upcoming fetch operation.
Implementations
sourceimpl<'remote, 'repo, T, P> Prepare<'remote, 'repo, T, P>where
T: Transport,
P: Progress,
impl<'remote, 'repo, T, P> Prepare<'remote, 'repo, T, P>where
T: Transport,
P: Progress,
sourcepub fn receive(self, should_interrupt: &AtomicBool) -> Result<Outcome, Error>
pub fn receive(self, should_interrupt: &AtomicBool) -> Result<Outcome, Error>
Receive the pack and perform the operation as configured by git via git-config
or overridden by various builder methods.
Return Ok(None)
if there was nothing to do because all remote refs are at the same state as they are locally, or Ok(Some(outcome))
to inform about all the changes that were made.
Negotiation
“fetch.negotiationAlgorithm” describes algorithms git
uses currently, with the default being consecutive
and skipping
being
experimented with. We currently implement something we could call ‘naive’ which works for now.
Deviation
When updating refs, the git-fetch
docs state that the following:
Unlike when pushing with git-push, any updates outside of refs/{tags,heads}/* will be accepted without + in the refspec (or –force), whether that’s swapping e.g. a tree object for a blob, or a commit for another commit that’s doesn’t have the previous commit as an ancestor etc.
We explicitly don’t special case those refs and expect the user to take control. Note that by its nature, force only applies to refs pointing to commits and if they don’t, they will be updated either way in our implementation as well.
sourceimpl<'remote, 'repo, T, P> Prepare<'remote, 'repo, T, P>where
T: Transport,
impl<'remote, 'repo, T, P> Prepare<'remote, 'repo, T, P>where
T: Transport,
Builder
sourcepub fn with_dry_run(self, enabled: bool) -> Self
pub fn with_dry_run(self, enabled: bool) -> Self
If dry run is enabled, no change to the repository will be made.
This works by not actually fetching the pack after negotiating it, nor will refs be updated.