diff options
author | Mx Kookie <kookie@spacekookie.de> | 2020-11-08 20:05:34 +0100 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-12-21 05:19:44 +0100 |
commit | eac42979146e10ed740f62c2ba6d09bf410f1187 (patch) | |
tree | 660287979f3ac419717afbb9c49b45ad48774099 /apps/servers/octopus/supergit/src/branch.rs | |
parent | 4c4d16d58c3d594938aa3ded26aa7e2fcebfc829 (diff) |
octopus: implementing supergit basic tree abstraction
Diffstat (limited to 'apps/servers/octopus/supergit/src/branch.rs')
-rw-r--r-- | apps/servers/octopus/supergit/src/branch.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/servers/octopus/supergit/src/branch.rs b/apps/servers/octopus/supergit/src/branch.rs index fe555d24292f..dd92aea93cba 100644 --- a/apps/servers/octopus/supergit/src/branch.rs +++ b/apps/servers/octopus/supergit/src/branch.rs @@ -8,8 +8,8 @@ use std::{mem, sync::Arc}; #[derive(Clone)] pub struct Branch { repo: Arc<Repository>, - pub name: Option<String>, - pub head: HashId, + name: Option<String>, + head: HashId, } impl Branch { @@ -77,6 +77,16 @@ impl Branch { SegLimit::Length(0, num), ) } + + /// Get the commit pointed at by HEAD + pub fn get_head(&self) -> Commit { + Commit::new(&self.repo, self.head.clone()).unwrap() + } + + /// Get the branch name, if it exists + pub fn name(&self) -> Option<String> { + self.name.clone() + } } /// A branch segment iterator |