Rename StackExt.new to create

This commit is contained in:
Kiril Videlov 2024-10-08 16:37:07 +02:00
parent 570c974544
commit 48bbe13d56
7 changed files with 12 additions and 12 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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<Refname>,
@ -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<Refname>,
@ -171,7 +171,7 @@ impl StackExt for Stack {
selected_for_changes: Option<i64>,
allow_rebasing: bool,
) -> Self {
let mut branch = Stack::new_uninitialized(
let mut branch = Stack::new(
name,
source_refname,
upstream,

View File

@ -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<Refname>,
upstream: Option<RemoteRefname>,

View File

@ -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,