aboutsummaryrefslogtreecommitdiff
path: root/supergit/src/branch.rs
blob: 81abbffed11287e73ae42e7e648f7b2bab088135 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use crate::{Commit, CommitId};

/// Abstraction for a branch history slice
pub struct Branch {
    name: String,
    head: CommitId,
    history: Vec<BranchCommit>,
}

/// A commit represented as a relationship to a branch
///
/// Most commits will be simple, meaning they are in sequence on the
/// branch.  Two types of merge commits exist: normal, and octopus.
/// All branches leading into this branch are a reverse tree
pub enum BranchCommit {
    /// A single commit
    Commit(Commit),
    /// A merge commit from one other branch
    Merge(Branch),
    /// An octopus merge with multiple branches
    Octopus(Vec<Branch>),
}