Skip to main content

Module reconcile

Module reconcile 

Source
Expand description

Deciding what a local branch and its remote twin mean when both moved.

A run’s branch can be rewritten on one side only: magi rebases it locally (a retry, a fixer) and, until this module, never pushed the result, so the next attempt found refs/heads/<b> and <remote>/<b> diverged - the same change on two different bases. Picking the remote side there silently discards the rebase; picking the local one discards whatever a person pushed. classify therefore only lets magi settle the question when it can prove nothing is lost, and otherwise hands both sides to the operator as a Diverged that says what each one carries.

The proof is patch-id, via git cherry: two commits that apply the same diff are the same change on different bases. A merge, a squash or a rebase that needed conflict resolution changes the patch-id and is therefore Divergence::Genuine - the safe side of every doubt.

Structs§

Choice
The owner’s answer to a divergence question, with the tips they were shown.
Commit
One commit on one side of a divergence.
Diverged
A divergence magi could not settle by itself.
Stale
The owner’s answer described tips that no longer exist: nothing was done.

Enums§

Divergence
What a divergence turned out to be.
Reconciliation
What reconcile did.
Side
What the owner chose.

Constants§

NODE
Node the daemon records on the divergence question (daemon’s Diverged arm). There is no agent behind it, so crate::deputy::destructive names it.
SEAT
Seat recorded on the divergence question, with NODE.

Functions§

apply_choice
Carry out the owner’s decision, but only against the tips they were shown.
classify
Classify a divergence between local and origin (both shas).
origin_missing
What origin has that no local commit repeats: patches git cherry finds unmatched, plus every merge, which git cherry cannot see and which may carry conflict resolutions or other content of its own.
reconcile
If local is provably origin’s change rebased, push it with a lease pinned to origin and say so; Ok(false) when it is not.
summary_for
The question summary for branch on remote.