mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-08-16 15:50:37 +03:00
remove inappropriate path function from repo actions trait
This commit is contained in:
parent
6dcbb8bddb
commit
50577f3865
@ -1903,7 +1903,7 @@ pub fn write_tree_onto_tree(
|
||||
for (rel_path, hunks) in files {
|
||||
let rel_path = rel_path.borrow();
|
||||
let hunks = hunks.borrow();
|
||||
let full_path = project_repository.path().join(rel_path);
|
||||
let full_path = project_repository.project().worktree_path().join(rel_path);
|
||||
|
||||
let is_submodule = full_path.is_dir()
|
||||
&& hunks.len() == 1
|
||||
@ -1950,7 +1950,7 @@ pub fn write_tree_onto_tree(
|
||||
|
||||
// if the link target is inside the project repository, make it relative
|
||||
let link_target = link_target
|
||||
.strip_prefix(project_repository.path())
|
||||
.strip_prefix(project_repository.project().worktree_path())
|
||||
.unwrap_or(&link_target);
|
||||
|
||||
let blob_oid = git_repository.blob(
|
||||
|
@ -1,5 +1,4 @@
|
||||
use std::{
|
||||
path,
|
||||
str::FromStr,
|
||||
sync::{atomic::AtomicUsize, Arc},
|
||||
};
|
||||
@ -139,14 +138,9 @@ pub trait RepoActions {
|
||||
fn get_head(&self) -> Result<git2::Reference>;
|
||||
fn git_index_size(&self) -> Result<usize>;
|
||||
fn config(&self) -> super::Config;
|
||||
fn path(&self) -> &path::Path;
|
||||
}
|
||||
|
||||
impl RepoActions for ProjectRepo {
|
||||
fn path(&self) -> &path::Path {
|
||||
path::Path::new(&self.project.path)
|
||||
}
|
||||
|
||||
fn config(&self) -> super::Config {
|
||||
super::Config::from(&self.git_repository)
|
||||
}
|
||||
@ -493,7 +487,7 @@ impl RepoActions for ProjectRepo {
|
||||
// NOTE(qix-): work around a time-sensitive change that was necessary
|
||||
// NOTE(qix-): without having to refactor a large portion of the codebase.
|
||||
if self.project.preferred_key == AuthKey::SystemExecutable {
|
||||
let path = self.path().to_path_buf();
|
||||
let path = self.project.worktree_path();
|
||||
let remote = branch.remote().to_string();
|
||||
return std::thread::spawn(move || {
|
||||
tokio::runtime::Runtime::new()
|
||||
@ -589,7 +583,7 @@ impl RepoActions for ProjectRepo {
|
||||
// NOTE(qix-): work around a time-sensitive change that was necessary
|
||||
// NOTE(qix-): without having to refactor a large portion of the codebase.
|
||||
if self.project.preferred_key == AuthKey::SystemExecutable {
|
||||
let path = self.path().to_path_buf();
|
||||
let path = self.project.worktree_path();
|
||||
let remote = remote_name.to_string();
|
||||
return std::thread::spawn(move || {
|
||||
tokio::runtime::Runtime::new()
|
||||
|
@ -120,4 +120,8 @@ impl Project {
|
||||
pub fn snapshot_lines_threshold(&self) -> usize {
|
||||
self.snapshot_lines_threshold.unwrap_or(20)
|
||||
}
|
||||
|
||||
pub fn worktree_path(&self) -> PathBuf {
|
||||
self.path.clone()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user