mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-29 12:33:49 +03:00
remove useless indirection when getting index size
This commit is contained in:
parent
569d282700
commit
c62c43ed6c
@ -138,15 +138,9 @@ pub trait RepoActions {
|
|||||||
where
|
where
|
||||||
P: AsRef<std::path::Path>;
|
P: AsRef<std::path::Path>;
|
||||||
fn get_head(&self) -> Result<git2::Reference>;
|
fn get_head(&self) -> Result<git2::Reference>;
|
||||||
fn git_index_size(&self) -> Result<usize>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RepoActions for ProjectRepo {
|
impl RepoActions for ProjectRepo {
|
||||||
fn git_index_size(&self) -> Result<usize> {
|
|
||||||
let head = self.git_repository.index()?.len();
|
|
||||||
Ok(head)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_head(&self) -> Result<git2::Reference> {
|
fn get_head(&self) -> Result<git2::Reference> {
|
||||||
let head = self.git_repository.head()?;
|
let head = self.git_repository.head()?;
|
||||||
Ok(head)
|
Ok(head)
|
||||||
|
@ -60,8 +60,10 @@ impl App {
|
|||||||
let project = self.projects.get(project_id)?;
|
let project = self.projects.get(project_id)?;
|
||||||
let project_repository = project_repository::ProjectRepo::open(&project)?;
|
let project_repository = project_repository::ProjectRepo::open(&project)?;
|
||||||
let size = project_repository
|
let size = project_repository
|
||||||
.git_index_size()
|
.repo()
|
||||||
.context("failed to get index size")?;
|
.index()
|
||||||
|
.context("failed to get index size")?
|
||||||
|
.len();
|
||||||
Ok(size)
|
Ok(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user