diff --git a/crates/gitbutler-branch-actions/src/actions.rs b/crates/gitbutler-branch-actions/src/actions.rs index 1210cbd0e..6431448a1 100644 --- a/crates/gitbutler-branch-actions/src/actions.rs +++ b/crates/gitbutler-branch-actions/src/actions.rs @@ -230,11 +230,11 @@ pub fn update_branch_order( assure_open_workspace_mode(&ctx) .context("Updating branch order requires open workspace mode")?; for branch_update in branch_updates { - let branch = ctx + let stack = ctx .project() .virtual_branches() .get_branch_in_workspace(branch_update.id)?; - if branch_update.order != Some(branch.order) { + if branch_update.order != Some(stack.order) { vbranch::update_branch(&ctx, &branch_update)?; } } diff --git a/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs b/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs index d7f9ae4c6..3c5e0ff50 100644 --- a/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs +++ b/crates/gitbutler-branch-actions/src/branch_manager/branch_removal.rs @@ -66,19 +66,19 @@ impl BranchManager<'_> { delete_vb_state: bool, ) -> Result<()> { let vb_state = self.ctx.project().virtual_branches(); - let Some(branch) = vb_state.try_branch(stack_id)? else { + let Some(stack) = vb_state.try_branch(stack_id)? else { return Ok(()); }; // We don't want to try unapplying branches which are marked as not in workspace by the new metric - if !branch.in_workspace { + if !stack.in_workspace { return Ok(()); } _ = self .ctx .project() - .snapshot_branch_deletion(branch.name.clone(), perm); + .snapshot_branch_deletion(stack.name.clone(), perm); let repo = self.ctx.repository(); @@ -93,7 +93,7 @@ impl BranchManager<'_> { // doing this earlier in the flow, in case any of the steps that follow fail vb_state - .mark_as_not_in_workspace(branch.id) + .mark_as_not_in_workspace(stack.id) .context("Failed to remove branch")?; // go through the other applied branches and merge them into the final tree @@ -108,18 +108,18 @@ impl BranchManager<'_> { let merge_options = gix_repo.tree_merge_options()?; let final_tree_id = applied_statuses .into_iter() - .filter(|(branch, _)| branch.id != stack_id) + .filter(|(stack, _)| stack.id != stack_id) .try_fold( git2_to_gix_object_id(target_commit.tree_id()), |final_tree_id, status| -> Result<_> { - let branch = status.0; + let stack = status.0; let files = status .1 .into_iter() .map(|file| (file.path, file.hunks)) .collect::)>>(); let tree_oid = - gitbutler_diff::write::hunks_onto_oid(self.ctx, branch.head(), files)?; + gitbutler_diff::write::hunks_onto_oid(self.ctx, stack.head(), files)?; let mut merge = gix_repo.merge_trees( git2_to_gix_object_id(base_tree_id), final_tree_id, @@ -143,7 +143,7 @@ impl BranchManager<'_> { .context("failed to checkout tree")?; if delete_vb_state { - self.ctx.delete_branch_reference(&branch)?; + self.ctx.delete_branch_reference(&stack)?; } vbranch::ensure_selected_for_changes(&vb_state) diff --git a/crates/gitbutler-branch-actions/src/branch_upstream_integration.rs b/crates/gitbutler-branch-actions/src/branch_upstream_integration.rs index 41c818ccb..f75ea1c49 100644 --- a/crates/gitbutler-branch-actions/src/branch_upstream_integration.rs +++ b/crates/gitbutler-branch-actions/src/branch_upstream_integration.rs @@ -87,9 +87,9 @@ pub fn integrate_upstream_commits( let project = ctx.project(); let vb_state = project.virtual_branches(); - let branch = vb_state.get_branch_in_workspace(stack_id)?; + let stack = vb_state.get_branch_in_workspace(stack_id)?; - let Some(upstream_refname) = branch.clone().upstream else { + let Some(upstream_refname) = stack.clone().upstream else { bail!("No upstream reference found for branch"); }; @@ -98,7 +98,7 @@ pub fn integrate_upstream_commits( // If the upstream branch head is the same as the local, then the branch is // up to date. - if upstream_branch_head == branch.head() { + if upstream_branch_head == stack.head() { return Ok(()); } @@ -109,20 +109,20 @@ pub fn integrate_upstream_commits( let integrate_upstream_context = IntegrateUpstreamContext { repository, target_branch_head, - branch_head: branch.head(), - branch_tree: branch.tree, - branch_name: &branch.name, + branch_head: stack.head(), + branch_tree: stack.tree, + branch_name: &stack.name, remote_head: upstream_branch_head, remote_branch_name: upstream_branch.name()?.unwrap_or("Unknown"), - prefers_merge: !branch.allow_rebasing, + prefers_merge: !stack.allow_rebasing, }; let BranchHeadAndTree { head, tree } = integrate_upstream_context.inner_integrate_upstream_commits()?; - let mut branch = branch.clone(); + let mut stack = stack.clone(); - branch.set_stack_head(ctx, head, Some(tree))?; + stack.set_stack_head(ctx, head, Some(tree))?; checkout_branch_trees(ctx, perm)?; diff --git a/crates/gitbutler-branch-actions/src/upstream_integration.rs b/crates/gitbutler-branch-actions/src/upstream_integration.rs index 54cba03c5..e12110cb6 100644 --- a/crates/gitbutler-branch-actions/src/upstream_integration.rs +++ b/crates/gitbutler-branch-actions/src/upstream_integration.rs @@ -310,30 +310,30 @@ pub(crate) fn integrate_upstream( // could enter a much worse state if we're simultaniously updating trees // Delete branches - for (branch_id, integration_result) in &integration_results { + for (stack_id, integration_result) in &integration_results { if !matches!(integration_result, IntegrationResult::DeleteBranch) { continue; }; - let branch = virtual_branches_state.get_branch(*branch_id)?; - virtual_branches_state.delete_branch_entry(branch_id)?; - command_context.delete_branch_reference(&branch)?; + let stack = virtual_branches_state.get_branch(*stack_id)?; + virtual_branches_state.delete_branch_entry(stack_id)?; + command_context.delete_branch_reference(&stack)?; } let permission = context._permission.expect("Permission provided above"); // Unapply branches - for (branch_id, integration_result) in &integration_results { + for (stack_id, integration_result) in &integration_results { if !matches!(integration_result, IntegrationResult::UnapplyBranch) { continue; }; command_context .branch_manager() - .save_and_unapply(*branch_id, permission)?; + .save_and_unapply(*stack_id, permission)?; } - let mut branches = virtual_branches_state.list_branches_in_workspace()?; + let mut stacks = virtual_branches_state.list_branches_in_workspace()?; // Update branch trees for (branch_id, integration_result) in &integration_results { @@ -341,19 +341,19 @@ pub(crate) fn integrate_upstream( continue; }; - let Some(branch) = branches.iter_mut().find(|branch| branch.id == *branch_id) else { + let Some(stack) = stacks.iter_mut().find(|branch| branch.id == *branch_id) else { continue; }; - branch.set_stack_head(command_context, *head, Some(*tree))?; - branch.archive_integrated_heads(command_context)?; + stack.set_stack_head(command_context, *head, Some(*tree))?; + stack.archive_integrated_heads(command_context)?; } // checkout_branch_trees won't checkout anything if there are no // applied branches, and returns the current_wd_tree as its result. // This is very sensible, but in this case, we want to checkout the // new target sha. - if branches.is_empty() { + if stacks.is_empty() { context .repository .checkout_tree_builder(&context.new_target.tree()?) @@ -588,20 +588,20 @@ mod test { let old_target = test_repository.commit_tree(Some(&initial_commit), &[("foo.txt", "baz")]); let new_target = test_repository.commit_tree(Some(&old_target), &[("foo.txt", "qux")]); - let branch = make_branch(old_target.id(), old_target.tree_id()); + let stack = make_branch(old_target.id(), old_target.tree_id()); let context = UpstreamIntegrationContext { _permission: None, old_target, new_target, repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), - BranchStatuses::UpdatesRequired(vec![(branch.id, BranchStatus::Empty)]), + BranchStatuses::UpdatesRequired(vec![(stack.id, BranchStatus::Empty)]), ) } @@ -613,21 +613,21 @@ mod test { let branch_head = test_repository.commit_tree(Some(&old_target), &[("foo.txt", "fux")]); let new_target = test_repository.commit_tree(Some(&old_target), &[("foo.txt", "qux")]); - let branch = make_branch(branch_head.id(), branch_head.tree_id()); + let stack = make_branch(branch_head.id(), branch_head.tree_id()); let context = UpstreamIntegrationContext { _permission: None, old_target, new_target: new_target.clone(), repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), BranchStatuses::UpdatesRequired(vec![( - branch.id, + stack.id, BranchStatus::Conflicted { potentially_conflicted_uncommited_changes: false } @@ -637,8 +637,8 @@ mod test { let updates = compute_resolutions( &context, &[Resolution { - branch_id: branch.id, - branch_tree: branch.tree, + branch_id: stack.id, + branch_tree: stack.tree, approach: ResolutionApproach::Rebase, }], None, @@ -670,21 +670,21 @@ mod test { // new target diverged from old target let new_target = test_repository.commit_tree(Some(&initial_commit), &[("foo.txt", "qux")]); - let branch = make_branch(branch_head.id(), branch_head.tree_id()); + let stack = make_branch(branch_head.id(), branch_head.tree_id()); let context = UpstreamIntegrationContext { _permission: None, old_target, new_target: new_target.clone(), repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), BranchStatuses::UpdatesRequired(vec![( - branch.id, + stack.id, BranchStatus::Conflicted { potentially_conflicted_uncommited_changes: false } @@ -694,8 +694,8 @@ mod test { let updates = compute_resolutions( &context, &[Resolution { - branch_id: branch.id, - branch_tree: branch.tree, + branch_id: stack.id, + branch_tree: stack.tree, approach: ResolutionApproach::Rebase, }], Some(BaseBranchResolutionApproach::HardReset), @@ -729,27 +729,27 @@ mod test { let new_target = test_repository.commit_tree(Some(&initial_commit), &[("other.txt", "qux")]); - let branch = make_branch(branch_head.id(), branch_head.tree_id()); + let stack = make_branch(branch_head.id(), branch_head.tree_id()); let context = UpstreamIntegrationContext { _permission: None, old_target, new_target: new_target.clone(), repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), - BranchStatuses::UpdatesRequired(vec![(branch.id, BranchStatus::SaflyUpdatable)]), + BranchStatuses::UpdatesRequired(vec![(stack.id, BranchStatus::SaflyUpdatable)]), ); let updates = compute_resolutions( &context, &[Resolution { - branch_id: branch.id, - branch_tree: branch.tree, + branch_id: stack.id, + branch_tree: stack.tree, approach: ResolutionApproach::Rebase, }], Some(BaseBranchResolutionApproach::HardReset), @@ -781,7 +781,7 @@ mod test { // new target diverged from old target let new_target = test_repository.commit_tree(Some(&initial_commit), &[("foo.txt", "qux")]); - let branch = make_branch(branch_head.id(), branch_head.tree_id()); + let stack = make_branch(branch_head.id(), branch_head.tree_id()); let commits_to_rebase = test_repository .repository @@ -806,14 +806,14 @@ mod test { .find_commit(head_after_rebase) .unwrap(), repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), BranchStatuses::UpdatesRequired(vec![( - branch.id, + stack.id, BranchStatus::Conflicted { potentially_conflicted_uncommited_changes: false } @@ -823,8 +823,8 @@ mod test { let updates = compute_resolutions( &context, &[Resolution { - branch_id: branch.id, - branch_tree: branch.tree, + branch_id: stack.id, + branch_tree: stack.tree, approach: ResolutionApproach::Rebase, }], Some(BaseBranchResolutionApproach::Rebase), @@ -856,7 +856,7 @@ mod test { // new target diverged from old target let new_target = test_repository.commit_tree(Some(&initial_commit), &[("foo.txt", "qux")]); - let branch = make_branch(branch_head.id(), branch_head.tree_id()); + let stack = make_branch(branch_head.id(), branch_head.tree_id()); let commits_to_rebase = test_repository .repository @@ -881,20 +881,20 @@ mod test { .find_commit(head_after_rebase) .unwrap(), repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), - BranchStatuses::UpdatesRequired(vec![(branch.id, BranchStatus::SaflyUpdatable)]), + BranchStatuses::UpdatesRequired(vec![(stack.id, BranchStatus::SaflyUpdatable)]), ); let updates = compute_resolutions( &context, &[Resolution { - branch_id: branch.id, - branch_tree: branch.tree, + branch_id: stack.id, + branch_tree: stack.tree, approach: ResolutionApproach::Rebase, }], Some(BaseBranchResolutionApproach::Rebase), @@ -926,7 +926,7 @@ mod test { // new target diverged from old target let new_target = test_repository.commit_tree(Some(&initial_commit), &[("foo.txt", "qux")]); - let branch = make_branch(branch_head.id(), branch_head.tree_id()); + let stack = make_branch(branch_head.id(), branch_head.tree_id()); let merge_commit = gitbutler_merge_commits( &test_repository.repository, @@ -942,14 +942,14 @@ mod test { old_target, new_target: merge_commit.clone(), repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), BranchStatuses::UpdatesRequired(vec![( - branch.id, + stack.id, BranchStatus::Conflicted { potentially_conflicted_uncommited_changes: false } @@ -959,8 +959,8 @@ mod test { let updates = compute_resolutions( &context, &[Resolution { - branch_id: branch.id, - branch_tree: branch.tree, + branch_id: stack.id, + branch_tree: stack.tree, approach: ResolutionApproach::Rebase, }], Some(BaseBranchResolutionApproach::Merge), @@ -992,7 +992,7 @@ mod test { // new target diverged from old target let new_target = test_repository.commit_tree(Some(&initial_commit), &[("foo.txt", "qux")]); - let branch = make_branch(branch_head.id(), branch_head.tree_id()); + let stack = make_branch(branch_head.id(), branch_head.tree_id()); let merge_commit = gitbutler_merge_commits( &test_repository.repository, @@ -1008,20 +1008,20 @@ mod test { old_target, new_target: merge_commit.clone(), repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), - BranchStatuses::UpdatesRequired(vec![(branch.id, BranchStatus::SaflyUpdatable)]), + BranchStatuses::UpdatesRequired(vec![(stack.id, BranchStatus::SaflyUpdatable)]), ); let updates = compute_resolutions( &context, &[Resolution { - branch_id: branch.id, - branch_tree: branch.tree, + branch_id: stack.id, + branch_tree: stack.tree, approach: ResolutionApproach::Rebase, }], Some(BaseBranchResolutionApproach::Merge), @@ -1052,21 +1052,21 @@ mod test { let branch_head = test_repository.commit_tree(Some(&old_target), &[("foo.txt", "fux")]); let new_target = test_repository.commit_tree(Some(&old_target), &[("foo.txt", "qux")]); - let branch = make_branch(old_target.id(), branch_head.tree_id()); + let stack = make_branch(old_target.id(), branch_head.tree_id()); let context = UpstreamIntegrationContext { _permission: None, old_target, new_target, repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), BranchStatuses::UpdatesRequired(vec![( - branch.id, + stack.id, BranchStatus::Conflicted { potentially_conflicted_uncommited_changes: true } @@ -1083,21 +1083,21 @@ mod test { let branch_tree = test_repository.commit_tree(Some(&old_target), &[("foo.txt", "bax")]); let new_target = test_repository.commit_tree(Some(&old_target), &[("foo.txt", "qux")]); - let branch = make_branch(branch_head.id(), branch_tree.tree_id()); + let stack = make_branch(branch_head.id(), branch_tree.tree_id()); let context = UpstreamIntegrationContext { _permission: None, old_target, new_target, repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), BranchStatuses::UpdatesRequired(vec![( - branch.id, + stack.id, BranchStatus::Conflicted { potentially_conflicted_uncommited_changes: true } @@ -1112,20 +1112,20 @@ mod test { let old_target = test_repository.commit_tree(Some(&initial_commit), &[("foo.txt", "baz")]); let new_target = test_repository.commit_tree(Some(&old_target), &[("foo.txt", "qux")]); - let branch = make_branch(new_target.id(), new_target.tree_id()); + let stack = make_branch(new_target.id(), new_target.tree_id()); let context = UpstreamIntegrationContext { _permission: None, old_target, new_target, repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), - BranchStatuses::UpdatesRequired(vec![(branch.id, BranchStatus::FullyIntegrated)]), + BranchStatuses::UpdatesRequired(vec![(stack.id, BranchStatus::FullyIntegrated)]), ) } @@ -1143,20 +1143,20 @@ mod test { let tree = test_repository .commit_tree(Some(&old_target), &[("foo.txt", "baz"), ("bar.txt", "qux")]); - let branch = make_branch(new_target.id(), tree.tree_id()); + let stack = make_branch(new_target.id(), tree.tree_id()); let context = UpstreamIntegrationContext { _permission: None, old_target, new_target, repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), - BranchStatuses::UpdatesRequired(vec![(branch.id, BranchStatus::SaflyUpdatable)]), + BranchStatuses::UpdatesRequired(vec![(stack.id, BranchStatus::SaflyUpdatable)]), ) } @@ -1183,20 +1183,20 @@ mod test { &[("file-one.txt", "bar"), ("file-two.txt", "baz")], ); - let branch = make_branch(branch_head.id(), branch_tree.tree_id()); + let stack = make_branch(branch_head.id(), branch_tree.tree_id()); let context = UpstreamIntegrationContext { _permission: None, old_target, new_target, repository: &test_repository.repository, - virtual_branches_in_workspace: vec![branch.clone()], + virtual_branches_in_workspace: vec![stack.clone()], target_branch_name: "main".to_string(), }; assert_eq!( upstream_integration_statuses(&context).unwrap(), - BranchStatuses::UpdatesRequired(vec![(branch.id, BranchStatus::SaflyUpdatable)]), + BranchStatuses::UpdatesRequired(vec![(stack.id, BranchStatus::SaflyUpdatable)]), ) } } diff --git a/crates/gitbutler-branch-actions/src/virtual.rs b/crates/gitbutler-branch-actions/src/virtual.rs index 7c64476c9..7d86023d1 100644 --- a/crates/gitbutler-branch-actions/src/virtual.rs +++ b/crates/gitbutler-branch-actions/src/virtual.rs @@ -230,7 +230,7 @@ pub(crate) fn reset_files( ) -> Result<()> { ctx.assure_resolved()?; - let branch = ctx + let stack = ctx .project() .virtual_branches() .list_branches_in_workspace() @@ -240,7 +240,7 @@ pub(crate) fn reset_files( .with_context(|| { format!("could not find applied branch with id {stack_id} to reset files from") })?; - let claims: Vec<_> = branch + let claims: Vec<_> = stack .ownership .claims .into_iter() diff --git a/crates/gitbutler-cli/src/command/vbranch.rs b/crates/gitbutler-cli/src/command/vbranch.rs index 929f400c6..dafb7a800 100644 --- a/crates/gitbutler-cli/src/command/vbranch.rs +++ b/crates/gitbutler-cli/src/command/vbranch.rs @@ -57,19 +57,19 @@ pub fn status(project: Project) -> Result<()> { } pub fn unapply(project: Project, branch_name: String) -> Result<()> { - let branch = branch_by_name(&project, &branch_name)?; + let stack = branch_by_name(&project, &branch_name)?; debug_print(gitbutler_branch_actions::save_and_unapply_virutal_branch( - &project, branch.id, + &project, stack.id, )?) } pub fn apply(project: Project, branch_name: String) -> Result<()> { - let branch = branch_by_name(&project, &branch_name)?; + let stack = branch_by_name(&project, &branch_name)?; let ctx = CommandContext::open(&project)?; let mut guard = project.exclusive_worktree_access(); debug_print( ctx.branch_manager().create_virtual_branch_from_branch( - branch + stack .source_refname .as_ref() .context("local reference name was missing")?, @@ -96,8 +96,8 @@ pub fn create(project: Project, branch_name: String, set_default: bool) -> Resul } pub fn set_default(project: Project, branch_name: String) -> Result<()> { - let branch = branch_by_name(&project, &branch_name)?; - set_default_branch(&project, &branch) + let stack = branch_by_name(&project, &branch_name)?; + set_default_branch(&project, &stack) } fn set_default_branch(project: &Project, stack: &Stack) -> Result<()> { @@ -124,7 +124,7 @@ pub fn series(project: Project, stack_name: String, new_series_name: String) -> } pub fn commit(project: Project, branch_name: String, message: String) -> Result<()> { - let branch = branch_by_name(&project, &branch_name)?; + let stack = branch_by_name(&project, &branch_name)?; let (info, skipped) = gitbutler_branch_actions::list_virtual_branches(&project)?; if !skipped.is_empty() { @@ -136,7 +136,7 @@ pub fn commit(project: Project, branch_name: String, message: String) -> Result< let populated_branch = info .iter() - .find(|b| b.id == branch.id) + .find(|b| b.id == stack.id) .expect("A populated branch exists for a branch we can list"); if populated_branch.ownership.claims.is_empty() { bail!( @@ -165,7 +165,7 @@ pub fn commit(project: Project, branch_name: String, message: String) -> Result< let run_hooks = false; debug_print(gitbutler_branch_actions::create_commit( &project, - branch.id, + stack.id, &message, Some(&populated_branch.ownership), run_hooks, diff --git a/crates/gitbutler-workspace/tests/branch_trees.rs b/crates/gitbutler-workspace/tests/branch_trees.rs index e4207e1c4..dd747a827 100644 --- a/crates/gitbutler-workspace/tests/branch_trees.rs +++ b/crates/gitbutler-workspace/tests/branch_trees.rs @@ -42,13 +42,13 @@ mod compute_updated_branch_head { let head = test_repository.commit_tree(Some(&base_commit), &[("foo.txt", "bar")]); let tree = test_repository.commit_tree(Some(&head), &[("foo.txt", "baz")]); - let branch = make_branch(head.id(), tree.tree_id()); + let stack = make_branch(head.id(), tree.tree_id()); let BranchHeadAndTree { head, tree } = - compute_updated_branch_head(&test_repository.repository, &branch, head.id()).unwrap(); + compute_updated_branch_head(&test_repository.repository, &stack, head.id()).unwrap(); - assert_eq!(head, branch.head()); - assert_eq!(tree, branch.tree); + assert_eq!(head, stack.head()); + assert_eq!(tree, stack.tree); } /// When the head ID is different from the branch ID, we should rebase the @@ -67,12 +67,12 @@ mod compute_updated_branch_head { let tree = test_repository.commit_tree(Some(&head), &[("foo.txt", "bar"), ("bar.txt", "baz")]); - let branch = make_branch(head.id(), tree.tree_id()); + let stack = make_branch(head.id(), tree.tree_id()); let new_head = test_repository.commit_tree(Some(&base_commit), &[("foo.txt", "new")]); let BranchHeadAndTree { head, tree } = - compute_updated_branch_head(&test_repository.repository, &branch, new_head.id()) + compute_updated_branch_head(&test_repository.repository, &stack, new_head.id()) .unwrap(); assert_eq!(head, new_head.id()); @@ -97,12 +97,12 @@ mod compute_updated_branch_head { let head = test_repository.commit_tree(Some(&base_commit), &[("foo.txt", "bar")]); let tree = test_repository.commit_tree(Some(&head), &[("foo.txt", "baz")]); - let branch = make_branch(head.id(), tree.tree_id()); + let stack = make_branch(head.id(), tree.tree_id()); let new_head = test_repository.commit_tree(Some(&base_commit), &[("foo.txt", "new")]); let BranchHeadAndTree { head, tree } = - compute_updated_branch_head(&test_repository.repository, &branch, new_head.id()) + compute_updated_branch_head(&test_repository.repository, &stack, new_head.id()) .unwrap(); let new_new_head = test_repository.repository.find_commit(head).unwrap();