diff options
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 |