mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-18 23:02:31 +03:00
Rename StackExt.new to create
This commit is contained in:
parent
570c974544
commit
48bbe13d56
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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>,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user