mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-08-16 15:50:37 +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
|
||||
P: AsRef<std::path::Path>;
|
||||
fn get_head(&self) -> Result<git2::Reference>;
|
||||
fn git_index_size(&self) -> Result<usize>;
|
||||
}
|
||||
|
||||
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> {
|
||||
let head = self.git_repository.head()?;
|
||||
Ok(head)
|
||||
|
@ -60,8 +60,10 @@ impl App {
|
||||
let project = self.projects.get(project_id)?;
|
||||
let project_repository = project_repository::ProjectRepo::open(&project)?;
|
||||
let size = project_repository
|
||||
.git_index_size()
|
||||
.context("failed to get index size")?;
|
||||
.repo()
|
||||
.index()
|
||||
.context("failed to get index size")?
|
||||
.len();
|
||||
Ok(size)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user