gix_protocol::fetch::negotiate

Function add_wants

Source
pub fn add_wants(
    objects: &impl FindHeader,
    arguments: &mut Arguments,
    ref_map: &RefMap,
    remote_ref_target_known: &[bool],
    shallow: &Shallow,
    mapping_is_ignored: impl Fn(&Mapping) -> bool,
) -> bool
Available on crate feature fetch only.
Expand description

Add all ‘wants’ to arguments once it’s known negotiation is necessary.

This is a call to be made when mark_complete_and_common_ref() returned Action::MustNegotiate. That variant also contains the remote_ref_target_known field which is supposed to be passed here.

objects are used to see if remote ids are known here and are tags, in which case they are also added as ‘haves’ as negotiators don’t see tags at all.

  • ref_map is the state of refs as known on the remote.
  • shallow defines if the history should be shallow.
  • mapping_is_ignored is typically initialized with make_refmapping_ignore_predicate.

Returns true if at least one want was added, or false otherwise. Note that not adding a single want can make the remote hang, so it’s avoided on the client side by ending the fetch operation.