Skip to main content

push

Function push 

Source
pub fn push(
    request: PushRequest<'_>,
    services: PushServices<'_>,
) -> Result<PushOutcome>
Expand description

Push refspecs to a resolved destination from the repository at git_dir.

Performs the work the CLI’s push_http_repository/push_local_repository did: advertises the remote’s refs, plans the receive-pack commands for refspecs, rejects non-fast-forward branch updates (unless forced), builds the pack of objects the remote lacks, sends the receive-pack request, parses and validates the report-status, and returns the executed commands. remote is the remote/argument the caller resolved destination from (used only for error messages here).

Returns the structured PushOutcome; never prints or returns GitError::Exit. A still-None report in the outcome means the remote did not advertise report-status. Set-upstream config and the “To ” summary are the caller’s job, driven from PushOutcome::commands.