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,
)
| 610 | /// caller must first observe the remote explicitly or push without force |
| 611 | /// (Git's own non-fast-forward refusal still applies). |
| 612 | pub 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 |