pub struct PushOptions {
pub atomic: bool,
pub dry_run: bool,
pub tracking_remote: Option<String>,
pub push_options: Vec<String>,
pub diagnostics: Option<DiagnosticsHandle>,
pub network_trace: bool,
pub remote_ref_tips: Option<Vec<ObjectId>>,
pub resumable_threshold: Option<u64>,
pub no_verify: bool,
}Expand description
Options controlling a push.
Fields§
§atomic: boolApply all updates atomically (all-or-nothing), including remote hook rejections.
Wire pushes require the server’s atomic capability. If it is absent,
returns crate::error::Error::PushAtomicUnsupported before sending any
ref-update commands or objects, including with Self::dry_run. There
is no fallback to a non-atomic push.
dry_run: boolCompute results without writing to the remote.
tracking_remote: Option<String>When set, update refs/remotes/<name>/... in the local repo after a
successful push (matching Git’s post-push tracking ref maintenance).
push_options: Vec<String>Server-side push options to transmit (git push --push-option <value>).
When non-empty, the negotiated capability list includes push-options
and one push-option <value> pkt-line per entry is written after the
ref-update command block and before the flush/pack. The remote exposes
these to its hooks via GIT_PUSH_OPTION_COUNT / GIT_PUSH_OPTION_<n>.
If this is non-empty but the remote git-receive-pack does not advertise
the push-options capability, the push fails with
crate::error::Error::PushOptionsUnsupported (matching Git). A local-path or
file:// push (push_local) accepts them only when the destination repository
sets receive.advertisePushOptions, and passes them to its pre-receive and
post-receive hooks. Either check runs before anything is written, dry runs included.
diagnostics: Option<DiagnosticsHandle>Diagnostic sink for crate::diagnostics::Trace::Network events.
network_trace: boolWhen true with Self::diagnostics, push paths may emit network trace events.
remote_ref_tips: Option<Vec<ObjectId>>Ref tips already read from the remote, for example while planning
(PushPlanContext::remote_tips).
A local push uses them as the objects the remote already has instead of listing the remote’s refs again; ref updates still check each destination’s current value. They must come from the push destination, or objects the destination lacks may be left out of the pack. Wire pushes read the advertisement from their connection and ignore this.
resumable_threshold: Option<u64>Packs larger than this many bytes go to the server’s resumable
pushBundle endpoint, when it advertises one, instead of the
receive-pack request. None uses push.bundleThreshold from config,
else 16 MiB.
no_verify: boolSkip the client-side pre-push hook.
crate::remote::Remote::push runs the hook (see
crate::hooks::run_pre_push_hook) after reading the remote’s refs and before sending
anything, dry runs included, and fails with Error::Hook when it exits non-zero. The
lower-level push_local and crate::push::push_remote have no repository or
remote name to give the hook and never run it.