move the stacking impl to repo crate

There is just too big of a dependency in both directions to be able to have a separation at this time. The gitbutler-repo crate is needed for the stacking functionality and the `rebase` module inside of it needs to use the new API in order to maintain consistency during rebasing.
This commit is contained in:
Kiril Videlov 2024-08-22 23:29:13 +02:00
parent 9d6508b849
commit 12f826b9ad
No known key found for this signature in database
GPG Key ID: A4C733025427C471
11 changed files with 15 additions and 50 deletions

17
Cargo.lock generated
View File

@ -2432,6 +2432,7 @@ dependencies = [
"gitbutler-url",
"gitbutler-user",
"gix",
"itertools 0.13.0",
"log",
"resolve-path",
"serde",
@ -2465,22 +2466,6 @@ dependencies = [
"serde",
]
[[package]]
name = "gitbutler-stack"
version = "0.0.0"
dependencies = [
"anyhow",
"git2",
"gitbutler-branch",
"gitbutler-command-context",
"gitbutler-reference",
"gitbutler-repo",
"gitbutler-testsupport",
"itertools 0.13.0",
"pretty_assertions",
"tempfile",
]
[[package]]
name = "gitbutler-storage"
version = "0.0.0"

View File

@ -30,7 +30,6 @@ members = [
"crates/gitbutler-diff",
"crates/gitbutler-operating-modes",
"crates/gitbutler-edit-mode",
"crates/gitbutler-stack",
]
resolver = "2"
@ -83,7 +82,6 @@ gitbutler-url = { path = "crates/gitbutler-url" }
gitbutler-diff = { path = "crates/gitbutler-diff" }
gitbutler-operating-modes = { path = "crates/gitbutler-operating-modes" }
gitbutler-edit-mode = { path = "crates/gitbutler-edit-mode" }
gitbutler-stack = { path = "crates/gitbutler-stack" }
[profile.release]
codegen-units = 1 # Compile crates one after another so the compiler can optimize better

View File

@ -35,6 +35,7 @@ gitbutler-time.workspace = true
gitbutler-commit.workspace = true
gitbutler-url.workspace = true
uuid.workspace = true
itertools = "0.13"
[[test]]
name = "repo"

View File

@ -18,3 +18,10 @@ pub use config::Config;
pub mod askpass;
mod conflicts;
mod reference;
pub use reference::{
create_branch_reference, list_branch_references, list_commit_references, push_branch_reference,
update_branch_reference,
};

View File

@ -1,6 +1,8 @@
use std::collections::HashMap;
use std::str::FromStr;
use crate::credentials::Helper;
use crate::{LogUntil, RepoActionsExt};
use anyhow::Context;
use anyhow::{anyhow, Result};
use gitbutler_branch::BranchReference;
@ -8,8 +10,6 @@ use gitbutler_branch::VirtualBranchesHandle;
use gitbutler_branch::{Branch, BranchId};
use gitbutler_command_context::CommandContext;
use gitbutler_reference::ReferenceName;
use gitbutler_repo::credentials::Helper;
use gitbutler_repo::{LogUntil, RepoActionsExt};
use itertools::Itertools;
/// Given a branch id, returns the the GitButler references associated with the branch.

View File

@ -1 +1,2 @@
mod credentials;
mod reference;

View File

@ -1,10 +1,9 @@
use anyhow::Result;
use gitbutler_branch::VirtualBranchesHandle;
use gitbutler_command_context::CommandContext;
use gitbutler_repo::{credentials::Helper, LogUntil, RepoActionsExt};
use gitbutler_stack::{
create_branch_reference, list_branch_references, list_commit_references, push_branch_reference,
update_branch_reference,
use gitbutler_repo::{
create_branch_reference, credentials::Helper, list_branch_references, list_commit_references,
push_branch_reference, update_branch_reference, LogUntil, RepoActionsExt,
};
use tempfile::TempDir;

View File

@ -1,20 +0,0 @@
[package]
name = "gitbutler-stack"
version = "0.0.0"
edition = "2021"
authors = ["GitButler <gitbutler@gitbutler.com>"]
publish = false
[dependencies]
git2.workspace = true
anyhow.workspace = true
gitbutler-command-context.workspace = true
gitbutler-branch.workspace = true
gitbutler-reference.workspace = true
gitbutler-repo.workspace = true
itertools = "0.13"
[dev-dependencies]
pretty_assertions = "1.4"
gitbutler-testsupport.workspace = true
tempfile = "3.10.1"

View File

@ -1,5 +0,0 @@
mod reference;
pub use reference::{
create_branch_reference, list_branch_references, list_commit_references, push_branch_reference,
update_branch_reference,
};

View File

@ -1 +0,0 @@
mod reference;