Add API for accessing git branch
This commit is contained in:
parent
26afd592c5
commit
3570810516
2 changed files with 20 additions and 0 deletions
|
@ -66,6 +66,10 @@ impl<V: View> Flex<V> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
self.children.is_empty()
|
||||||
|
}
|
||||||
|
|
||||||
fn layout_flex_children(
|
fn layout_flex_children(
|
||||||
&mut self,
|
&mut self,
|
||||||
layout_expanded: bool,
|
layout_expanded: bool,
|
||||||
|
|
|
@ -133,6 +133,10 @@ impl RepositoryEntry {
|
||||||
pub(crate) fn in_dot_git(&self, path: &Path) -> bool {
|
pub(crate) fn in_dot_git(&self, path: &Path) -> bool {
|
||||||
path.starts_with(self.git_dir_path.as_ref())
|
path.starts_with(self.git_dir_path.as_ref())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn branch(&self) -> Option<Arc<str>> {
|
||||||
|
self.branch.clone()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This path corresponds to the 'content path' (the folder that contains the .git)
|
/// This path corresponds to the 'content path' (the folder that contains the .git)
|
||||||
|
@ -160,6 +164,12 @@ impl Deref for RepositoryWorkDirectory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> From<&'a str> for RepositoryWorkDirectory {
|
||||||
|
fn from(value: &'a str) -> Self {
|
||||||
|
RepositoryWorkDirectory(Path::new(value).into())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq)]
|
#[derive(Clone, Debug, Ord, PartialOrd, Eq, PartialEq)]
|
||||||
pub struct RepoPath(PathBuf);
|
pub struct RepoPath(PathBuf);
|
||||||
|
|
||||||
|
@ -1443,6 +1453,12 @@ impl Snapshot {
|
||||||
&self.root_name
|
&self.root_name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn root_git_entry(&self) -> Option<RepositoryEntry> {
|
||||||
|
self.repository_entries
|
||||||
|
.get(&"".into())
|
||||||
|
.map(|entry| entry.to_owned())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn scan_id(&self) -> usize {
|
pub fn scan_id(&self) -> usize {
|
||||||
self.scan_id
|
self.scan_id
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue