Skip to main content

InFlightOp

Enum InFlightOp 

Source
pub enum InFlightOp {
    Merge,
    Rebase,
    CherryPick,
    Revert,
    ApplyPatch,
}
Expand description

A multi-commit operation stopped mid-flight.

Ordered by specificity in InFlightOp::detect: git am and rebase share the rebase-apply directory, so the more specific marker is tested first.

Variants§

§

Merge

A merge stopped with conflicts — MERGE_HEAD.

§

Rebase

A rebase stopped at a conflict or an edit stop — rebase-merge/ (the default backend) or rebase-apply/ (the legacy --apply backend).

§

CherryPick

A cherry-pick sequence stopped — CHERRY_PICK_HEAD.

§

Revert

A revert sequence stopped — REVERT_HEAD.

§

ApplyPatch

git am stopped applying a patch — rebase-apply/applying.

Implementations§

Source§

impl InFlightOp

Source

pub const ALL: [Self; 5]

Every variant, for exhaustive tests and label tables.

Source

pub fn label(self) -> &'static str

The headerline alert for this state, in the wording git itself uses when it tells the user what to do next.

Source

pub fn ours_is_local(self) -> bool

Which side of a conflict “us” and “them” name during this operation — and they INVERT between the two families.

In a merge, “us” is the branch you are on and “them” is the branch being merged in, which is what everyone expects. In a rebase, cherry-pick, revert or am, git replays your work ONTO the other side, so “us” is the upstream being replayed onto and “them” is your own commit.

This is the single most confusing thing about resolving a conflict mid-rebase, and it is why the unmerged labels (“added by us”, “deleted by them”) are ambiguous without knowing which operation produced them.

Source

pub fn detect(repo: &Repository) -> Option<Self>

Detect the operation in flight, or None when the repository is idle.

At most one is reported. They are not strictly exclusive in git’s data model — a rebase that hits a conflict while cherry-picking a commit writes CHERRY_PICK_HEAD too — so the order matters: the outer operation is the one the user has to finish, and the one whose --continue they need.

Source

pub fn detect_in(gitdir: &Path) -> Option<Self>

Self::detect against a gitdir path directly, so it is testable without a live repository.

Trait Implementations§

Source§

impl Clone for InFlightOp

Source§

fn clone(&self) -> InFlightOp

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for InFlightOp

Source§

impl Debug for InFlightOp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for InFlightOp

Source§

impl Hash for InFlightOp

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for InFlightOp

Source§

fn eq(&self, other: &InFlightOp) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for InFlightOp

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.