Skip to main content

memstead_base/ops/
branch_reset.rs

1//! Wire types for `Engine::branch_reset`.
2//!
3//! fetch / pull / push / branch_reset form one transport surface; this op is the lone history-rewrite
4//! primitive the others compose against.
5
6use serde::{Deserialize, Serialize};
7
8/// Successful outcome of `Engine::branch_reset`. Carries enough
9/// context for callers (CLI, replay skills, audit UIs) to surface
10/// what happened without a follow-up `memstead_changes_since` poll.
11#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
12pub struct BranchResetOutcome {
13    /// Mem name whose branch pointer moved.
14    pub mem: String,
15    /// Full ref name of the moved branch (`refs/heads/<mem>` for
16    /// flat layouts, `refs/heads/<path>/<mem>` for hierarchical
17    /// ones).
18    pub branch_ref: String,
19    /// SHA the branch pointed at before the reset.
20    pub previous_sha: String,
21    /// SHA the branch points at after the reset.
22    pub new_sha: String,
23    /// SHAs of the commits that the reset moved away from — every
24    /// commit reachable from `previous_sha` but not from `new_sha`.
25    /// Empty when the reset was a no-op (target == current head).
26    /// Implementer guarantees: every entry was unpushed at the
27    /// instant of the safety probe; nothing in the list was reachable
28    /// from any `refs/remotes/*` ref.
29    pub discarded_commits: Vec<String>,
30}