diff --git a/crates/gitbutler-branch-actions/src/base.rs b/crates/gitbutler-branch-actions/src/base.rs index a61529c63..b8b49ffe2 100644 --- a/crates/gitbutler-branch-actions/src/base.rs +++ b/crates/gitbutler-branch-actions/src/base.rs @@ -231,7 +231,7 @@ pub(crate) fn set_base_branch( (None, None) }; - let mut branch = Stack::new_uninitialized( + let mut branch = Stack::new( head_name.to_string().replace("refs/heads/", ""), Some(head_name), upstream, diff --git a/crates/gitbutler-branch-actions/src/branch_manager/branch_creation.rs b/crates/gitbutler-branch-actions/src/branch_manager/branch_creation.rs index 832fad605..98e4e9a20 100644 --- a/crates/gitbutler-branch-actions/src/branch_manager/branch_creation.rs +++ b/crates/gitbutler-branch-actions/src/branch_manager/branch_creation.rs @@ -100,7 +100,7 @@ impl BranchManager<'_> { } } - let mut branch = Stack::new_uninitialized( + let mut branch = Stack::new( name.clone(), None, None, @@ -235,7 +235,7 @@ impl BranchManager<'_> { branch } else { let upstream_head = upstream_branch.is_some().then_some(head_commit.id()); - Stack::new_uninitialized( + Stack::new( branch_name.clone(), Some(target.clone()), upstream_branch, diff --git a/crates/gitbutler-branch-actions/src/upstream_integration.rs b/crates/gitbutler-branch-actions/src/upstream_integration.rs index fb61d1e6f..5d95ca473 100644 --- a/crates/gitbutler-branch-actions/src/upstream_integration.rs +++ b/crates/gitbutler-branch-actions/src/upstream_integration.rs @@ -503,7 +503,7 @@ mod test { use super::*; fn make_branch(head: git2::Oid, tree: git2::Oid) -> Stack { - let mut branch = Stack::new_uninitialized( + let mut branch = Stack::new( "branchy branch".into(), None, None, diff --git a/crates/gitbutler-branch-actions/tests/virtual_branches/branch_trees.rs b/crates/gitbutler-branch-actions/tests/virtual_branches/branch_trees.rs index 91096ca66..fc0dfd669 100644 --- a/crates/gitbutler-branch-actions/tests/virtual_branches/branch_trees.rs +++ b/crates/gitbutler-branch-actions/tests/virtual_branches/branch_trees.rs @@ -5,7 +5,7 @@ use gitbutler_stack::Stack; /// This assumes that the only relevant properties for your test are the head /// and tree Oids. fn make_branch(head: git2::Oid, tree: git2::Oid) -> Stack { - let mut branch = Stack::new_uninitialized( + let mut branch = Stack::new( "branchy branch".into(), None, None, diff --git a/crates/gitbutler-stack-api/src/stack_ext.rs b/crates/gitbutler-stack-api/src/stack_ext.rs index 4b6a0c5e5..cc13843d5 100644 --- a/crates/gitbutler-stack-api/src/stack_ext.rs +++ b/crates/gitbutler-stack-api/src/stack_ext.rs @@ -36,7 +36,7 @@ pub trait StackExt { /// Constructs and initializes a new Stack. /// If initialization fails, a warning is logged and the stack is returned as is. #[allow(clippy::too_many_arguments)] - fn new( + fn create( ctx: &CommandContext, name: String, source_refname: Option, @@ -159,7 +159,7 @@ pub struct TargetUpdate { /// If there are multiple heads that point to the same patch, the `add` and `update` operations can specify the intended order. impl StackExt for Stack { #[allow(clippy::too_many_arguments)] - fn new( + fn create( ctx: &CommandContext, name: String, source_refname: Option, @@ -171,7 +171,7 @@ impl StackExt for Stack { selected_for_changes: Option, allow_rebasing: bool, ) -> Self { - let mut branch = Stack::new_uninitialized( + let mut branch = Stack::new( name, source_refname, upstream, diff --git a/crates/gitbutler-stack/src/stack.rs b/crates/gitbutler-stack/src/stack.rs index 30b7594cd..00a7f81ae 100644 --- a/crates/gitbutler-stack/src/stack.rs +++ b/crates/gitbutler-stack/src/stack.rs @@ -84,10 +84,10 @@ where } impl Stack { - /// DO NOT USE THIS DIRECTLY, use `StackActions::new` instead. + /// DO NOT USE THIS DIRECTLY, use `stack_ext::StackExt::create` instead. /// Creates a new `Branch` with the given name. The `in_workspace` flag is set to `true`. #[allow(clippy::too_many_arguments)] - pub fn new_uninitialized( + pub fn new( name: String, source_refname: Option, upstream: Option, diff --git a/crates/gitbutler-stack/tests/ownership.rs b/crates/gitbutler-stack/tests/ownership.rs index fa41a9d20..a12643e30 100644 --- a/crates/gitbutler-stack/tests/ownership.rs +++ b/crates/gitbutler-stack/tests/ownership.rs @@ -5,7 +5,7 @@ use gitbutler_stack::{reconcile_claims, BranchOwnershipClaims, OwnershipClaim, S #[test] fn reconcile_ownership_simple() { - let mut branch_a = Stack::new_uninitialized( + let mut branch_a = Stack::new( "a".to_string(), None, None, @@ -36,7 +36,7 @@ fn reconcile_ownership_simple() { branch_a.created_timestamp_ms = u128::default(); branch_a.updated_timestamp_ms = u128::default(); - let mut branch_b = Stack::new_uninitialized( + let mut branch_b = Stack::new( "b".to_string(), None, None,