Skip to main content

record_superseded

Function record_superseded 

Source
pub fn record_superseded(
    mkit_dir: &Path,
    op: &str,
    branch: &str,
    superseded: Hash,
) -> Result<(), (String, u8)>
Expand description

Record superseded (the old branch tip a history-rewriting op is about to replace) in the recovery log so mkit gc keeps it recoverable.

Call this before moving the ref and while holding the worktree lock (every caller does both): recording first guarantees that a persisted ref move always has a persisted recovery entry, and the lock keeps a concurrent recovery::expire from clobbering the append. On failure the caller MUST abort the rewrite (propagate the returned error) rather than orphan an unrecoverable commit. The zero hash is a no-op inside recovery::record.