aboutsummaryrefslogtreecommitdiff
path: root/supergit/src/branch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'supergit/src/branch.rs')
-rw-r--r--supergit/src/branch.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/supergit/src/branch.rs b/supergit/src/branch.rs
new file mode 100644
index 0000000..81abbff
--- /dev/null
+++ b/supergit/src/branch.rs
@@ -0,0 +1,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>),
+}