summaryrefslogtreecommitdiffstats
path: root/asyncgit/src/cached/branchname.rs
diff options
context:
space:
mode:
Diffstat (limited to 'asyncgit/src/cached/branchname.rs')
-rw-r--r--asyncgit/src/cached/branchname.rs66
1 files changed, 33 insertions, 33 deletions
diff --git a/asyncgit/src/cached/branchname.rs b/asyncgit/src/cached/branchname.rs
index 50ec7975..d5c53546 100644
--- a/asyncgit/src/cached/branchname.rs
+++ b/asyncgit/src/cached/branchname.rs
@@ -1,48 +1,48 @@
use crate::{
- error::Result,
- sync::{self, branch::get_branch_name},
+ error::Result,
+ sync::{self, branch::get_branch_name},
};
use sync::Head;
///
pub struct BranchName {
- last_result: Option<(Head, String)>,
- repo_path: String,
+ last_result: Option<(Head, String)>,
+ repo_path: String,
}
impl BranchName {
- ///
- pub fn new(path: &str) -> Self {
- Self {
- repo_path: path.to_string(),
- last_result: None,
- }
- }
+ ///
+ pub fn new(path: &str) -> Self {
+ Self {
+ repo_path: path.to_string(),
+ last_result: None,
+ }
+ }
- ///
- pub fn lookup(&mut self) -> Result<String> {
- let current_head =
- sync::get_head_tuple(self.repo_path.as_str())?;
+ ///
+ pub fn lookup(&mut self) -> Result<String> {
+ let current_head =
+ sync::get_head_tuple(self.repo_path.as_str())?;
- if let Some((last_head, branch_name)) =
- self.last_result.as_ref()
- {
- if *last_head == current_head {
- return Ok(branch_name.clone());
- }
- }
+ if let Some((last_head, branch_name)) =
+ self.last_result.as_ref()
+ {
+ if *last_head == current_head {
+ return Ok(branch_name.clone());
+ }
+ }
- self.fetch(current_head)
- }
+ self.fetch(current_head)
+ }
- ///
- pub fn last(&self) -> Option<String> {
- self.last_result.as_ref().map(|last| last.1.clone())
- }
+ ///
+ pub fn last(&self) -> Option<String> {
+ self.last_result.as_ref().map(|last| last.1.clone())
+ }
- fn fetch(&mut self, head: Head) -> Result<String> {
- let name = get_branch_name(self.repo_path.as_str())?;
- self.last_result = Some((head, name.clone()));
- Ok(name)
- }
+ fn fetch(&mut self, head: Head) -> Result<String> {
+ let name = get_branch_name(self.repo_path.as_str())?;
+ self.last_result = Some((head, name.clone()));
+ Ok(name)
+ }
}