mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-02 22:42:56 +03:00
get remove vbranches list as function parameter
This commit is contained in:
parent
4654529aa9
commit
4125dcef3b
@ -74,17 +74,9 @@ impl BranchManager<'_> {
|
||||
let target_commit = repo.target_commit()?;
|
||||
let base_tree = target_commit.tree().context("failed to get target tree")?;
|
||||
|
||||
let virtual_branches = vb_state
|
||||
.list_branches_in_workspace()
|
||||
.context("failed to read virtual branches")?;
|
||||
|
||||
let (applied_statuses, _, _) = get_applied_status(
|
||||
self.project_repository,
|
||||
&integration_commit.id(),
|
||||
virtual_branches,
|
||||
None,
|
||||
)
|
||||
.context("failed to get status by branch")?;
|
||||
let (applied_statuses, _, _) =
|
||||
get_applied_status(self.project_repository, &integration_commit.id(), None)
|
||||
.context("failed to get status by branch")?;
|
||||
|
||||
// go through the other applied branches and merge them into the final tree
|
||||
// then check that out into the working directory
|
||||
|
@ -231,19 +231,11 @@ pub fn unapply_ownership(
|
||||
|
||||
let vb_state = project_repository.project().virtual_branches();
|
||||
|
||||
let virtual_branches = vb_state
|
||||
.list_branches_in_workspace()
|
||||
.context("failed to read virtual branches")?;
|
||||
|
||||
let integration_commit_id = get_workspace_head(&vb_state, project_repository)?;
|
||||
|
||||
let (applied_statuses, _, _) = get_applied_status(
|
||||
project_repository,
|
||||
&integration_commit_id,
|
||||
virtual_branches,
|
||||
None,
|
||||
)
|
||||
.context("failed to get status by branch")?;
|
||||
let (applied_statuses, _, _) =
|
||||
get_applied_status(project_repository, &integration_commit_id, None)
|
||||
.context("failed to get status by branch")?;
|
||||
|
||||
let hunks_to_unapply = applied_statuses
|
||||
.iter()
|
||||
@ -1085,15 +1077,10 @@ pub fn get_status_by_branch(
|
||||
|
||||
let default_target = vb_state.get_default_target()?;
|
||||
|
||||
let virtual_branches = vb_state
|
||||
.list_branches_in_workspace()
|
||||
.context("failed to read virtual branches")?;
|
||||
|
||||
let (applied_status, skipped_files, locks) = get_applied_status(
|
||||
project_repository,
|
||||
// TODO: Keep this optional or update lots of tests?
|
||||
integration_commit.unwrap_or(&default_target.sha),
|
||||
virtual_branches,
|
||||
perm,
|
||||
)?;
|
||||
|
||||
@ -1195,13 +1182,16 @@ fn new_compute_locks(
|
||||
pub(crate) fn get_applied_status(
|
||||
project_repository: &ProjectRepository,
|
||||
integration_commit: &git2::Oid,
|
||||
mut virtual_branches: Vec<Branch>,
|
||||
perm: Option<&mut WorktreeWritePermission>,
|
||||
) -> Result<(
|
||||
AppliedStatuses,
|
||||
Vec<gitbutler_diff::FileDiff>,
|
||||
HashMap<Digest, Vec<HunkLock>>,
|
||||
)> {
|
||||
let mut virtual_branches = project_repository
|
||||
.project()
|
||||
.virtual_branches()
|
||||
.list_branches_in_workspace()?;
|
||||
let base_file_diffs =
|
||||
gitbutler_diff::workdir(project_repository.repo(), &integration_commit.to_owned())
|
||||
.context("failed to diff workdir")?;
|
||||
@ -2253,12 +2243,8 @@ pub(crate) fn amend(
|
||||
|
||||
let integration_commit_id = get_workspace_head(&vb_state, project_repository)?;
|
||||
|
||||
let (mut applied_statuses, _, _) = get_applied_status(
|
||||
project_repository,
|
||||
&integration_commit_id,
|
||||
virtual_branches,
|
||||
None,
|
||||
)?;
|
||||
let (mut applied_statuses, _, _) =
|
||||
get_applied_status(project_repository, &integration_commit_id, None)?;
|
||||
|
||||
let (ref mut target_branch, target_status) = applied_statuses
|
||||
.iter_mut()
|
||||
@ -2740,12 +2726,8 @@ pub(crate) fn move_commit(
|
||||
|
||||
let integration_commit_id = get_workspace_head(&vb_state, project_repository)?;
|
||||
|
||||
let (mut applied_statuses, _, _) = get_applied_status(
|
||||
project_repository,
|
||||
&integration_commit_id,
|
||||
applied_branches,
|
||||
None,
|
||||
)?;
|
||||
let (mut applied_statuses, _, _) =
|
||||
get_applied_status(project_repository, &integration_commit_id, None)?;
|
||||
|
||||
let (ref mut source_branch, source_status) = applied_statuses
|
||||
.iter_mut()
|
||||
|
Loading…
Reference in New Issue
Block a user