MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / remote_lease_refspec

Function remote_lease_refspec

atomic-cli/src/commands/git/transport.rs:612–621  ·  view source on GitHub ↗

The `--force-with-lease= : ` spec for one mapped remote update, from the mapping's `last_observed_remote`. `Some` expected oid → lease pinned to that exact value (a stale push refuses without overwriting newer external work). `None` → no lease: the caller must first observe the remote explicitly or push without force (Git's own non-fast-forward refusal still applies).

(
    last_observed_remote: Option<&str>,
    remote_ref: &str,
)

Source from the content-addressed store, hash-verified

610/// caller must first observe the remote explicitly or push without force
611/// (Git's own non-fast-forward refusal still applies).
612pub fn remote_lease_refspec(
613 last_observed_remote: Option<&str>,
614 remote_ref: &str,
615) -> Option<String> {
616 let expected = last_observed_remote?.trim();
617 if expected.is_empty() {
618 return None;
619 }
620 Some(format!("--force-with-lease={remote_ref}:{expected}"))
621}
622
623/// Atomic-remote closure source for the CLI (RFC §8.6 preferred transport).
624/// The repository-layer fetch flow is synchronous; this adapter drives the

Callers 2

push_to_remoteMethod · 0.85

Calls 1

is_emptyMethod · 0.45