diff --git a/Cargo.lock b/Cargo.lock index 091df9ce3..7eebd43bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2336,7 +2336,9 @@ dependencies = [ "gitbutler-project", "gitbutler-testsupport", "gitbutler-user", + "log", "resolve-path", + "serde", "serde_json", "tempfile", "thiserror", diff --git a/crates/gitbutler-branch/src/assets.rs b/crates/gitbutler-branch/src/assets.rs index 712a5cd9d..94516c884 100644 --- a/crates/gitbutler-branch/src/assets.rs +++ b/crates/gitbutler-branch/src/assets.rs @@ -1,11 +1,11 @@ use anyhow::Result; use futures::future::join_all; -use gitbutler_core::virtual_branches::Author; use gitbutler_user as users; use std::{collections::HashMap, path, sync, time::Duration}; use url::Url; use crate::{ + author::Author, base::BaseBranch, remote::{RemoteBranchData, RemoteCommit}, VirtualBranch, VirtualBranchCommit, diff --git a/crates/gitbutler-core/src/virtual_branches/author.rs b/crates/gitbutler-branch/src/author.rs similarity index 100% rename from crates/gitbutler-core/src/virtual_branches/author.rs rename to crates/gitbutler-branch/src/author.rs diff --git a/crates/gitbutler-branch/src/lib.rs b/crates/gitbutler-branch/src/lib.rs index 19c681c17..4c2feb000 100644 --- a/crates/gitbutler-branch/src/lib.rs +++ b/crates/gitbutler-branch/src/lib.rs @@ -16,3 +16,5 @@ pub mod files; pub mod remote; pub mod conflicts; + +mod author; diff --git a/crates/gitbutler-branch/src/remote.rs b/crates/gitbutler-branch/src/remote.rs index 0c9ec5df4..77e8a6671 100644 --- a/crates/gitbutler-branch/src/remote.rs +++ b/crates/gitbutler-branch/src/remote.rs @@ -8,7 +8,9 @@ use gitbutler_repo::{LogUntil, RepoActions, RepositoryExt}; use serde::Serialize; use gitbutler_core::git::{self, CommitExt}; -use gitbutler_core::virtual_branches::{target, Author}; +use gitbutler_core::virtual_branches::target; + +use crate::author::Author; // this struct is a mapping to the view `RemoteBranch` type in Typescript // found in src-tauri/src/routes/repo/[project_id]/types.ts diff --git a/crates/gitbutler-branch/src/virtual.rs b/crates/gitbutler-branch/src/virtual.rs index 97c25e2c4..d9b58607f 100644 --- a/crates/gitbutler-branch/src/virtual.rs +++ b/crates/gitbutler-branch/src/virtual.rs @@ -19,10 +19,10 @@ use diffy::{apply_bytes as diffy_apply, Line, Patch}; use git2::build::TreeUpdateBuilder; use git2::ErrorCode; use git2_hooks::HookResult; -use gitbutler_core::virtual_branches::Author; use hex::ToHex; use serde::{Deserialize, Serialize}; +use crate::author::Author; use crate::conflicts::{self, RepoConflicts}; use crate::integration::{get_integration_commiter, get_workspace_head}; use crate::remote::{branch_to_remote_branch, RemoteBranch}; diff --git a/crates/gitbutler-core/src/lib.rs b/crates/gitbutler-core/src/lib.rs index 7faa57f0e..f787c9cf8 100644 --- a/crates/gitbutler-core/src/lib.rs +++ b/crates/gitbutler-core/src/lib.rs @@ -13,7 +13,6 @@ clippy::too_many_lines )] -pub mod askpass; pub mod dedup; pub mod error; pub mod fs; diff --git a/crates/gitbutler-core/src/virtual_branches/mod.rs b/crates/gitbutler-core/src/virtual_branches/mod.rs index 45d884d67..b6519ce4c 100644 --- a/crates/gitbutler-core/src/virtual_branches/mod.rs +++ b/crates/gitbutler-core/src/virtual_branches/mod.rs @@ -2,9 +2,6 @@ pub mod branch; pub use branch::{Branch, BranchId}; pub mod target; -mod author; -pub use author::Author; - use lazy_static::lazy_static; lazy_static! { pub static ref GITBUTLER_INTEGRATION_REFERENCE: crate::git::LocalRefname = diff --git a/crates/gitbutler-repo/Cargo.toml b/crates/gitbutler-repo/Cargo.toml index a35f23f90..a25ac102f 100644 --- a/crates/gitbutler-repo/Cargo.toml +++ b/crates/gitbutler-repo/Cargo.toml @@ -14,6 +14,8 @@ tokio = { workspace = true, features = [ "rt-multi-thread", "rt", "macros" ] } gitbutler-git.workspace = true tracing = "0.1.40" tempfile = "3.10" +serde = { workspace = true, features = ["std"]} +log = "^0.4" thiserror.workspace = true resolve-path = "0.1.0" gitbutler-command-context.workspace = true diff --git a/crates/gitbutler-core/src/askpass.rs b/crates/gitbutler-repo/src/askpass.rs similarity index 98% rename from crates/gitbutler-core/src/askpass.rs rename to crates/gitbutler-repo/src/askpass.rs index b0a31a37e..0864eff96 100644 --- a/crates/gitbutler-core/src/askpass.rs +++ b/crates/gitbutler-repo/src/askpass.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, path::Path, sync::Arc}; use serde::Serialize; use tokio::sync::{oneshot, Mutex}; -use crate::{id::Id, virtual_branches::BranchId}; +use gitbutler_core::{id::Id, virtual_branches::BranchId}; static mut GLOBAL_ASKPASS_BROKER: Option = None; diff --git a/crates/gitbutler-repo/src/lib.rs b/crates/gitbutler-repo/src/lib.rs index 9916b9958..97c86a54b 100644 --- a/crates/gitbutler-repo/src/lib.rs +++ b/crates/gitbutler-repo/src/lib.rs @@ -14,3 +14,5 @@ pub mod credentials; mod config; pub use config::Config; + +pub mod askpass; diff --git a/crates/gitbutler-repo/src/repository.rs b/crates/gitbutler-repo/src/repository.rs index f5ae59318..0a7afaf69 100644 --- a/crates/gitbutler-repo/src/repository.rs +++ b/crates/gitbutler-repo/src/repository.rs @@ -4,14 +4,13 @@ use anyhow::{anyhow, Context, Result}; use gitbutler_command_context::ProjectRepo; use gitbutler_core::{ - askpass, error::Code, git::{self, CommitHeadersV2}, ssh, virtual_branches::{Branch, BranchId}, }; -use crate::Config; +use crate::{askpass, Config}; use gitbutler_project::AuthKey; use crate::{credentials::Helper, RepositoryExt}; diff --git a/crates/gitbutler-tauri/src/askpass.rs b/crates/gitbutler-tauri/src/askpass.rs index 9bc3e7bb0..64513d60e 100644 --- a/crates/gitbutler-tauri/src/askpass.rs +++ b/crates/gitbutler-tauri/src/askpass.rs @@ -1,8 +1,6 @@ pub mod commands { - use gitbutler_core::{ - askpass::{self, AskpassRequest}, - id::Id, - }; + use gitbutler_core::id::Id; + use gitbutler_repo::askpass::{self, AskpassRequest}; #[tauri::command(async)] #[tracing::instrument(skip(response))] diff --git a/crates/gitbutler-tauri/src/main.rs b/crates/gitbutler-tauri/src/main.rs index 297d837f2..3d0c1d13b 100644 --- a/crates/gitbutler-tauri/src/main.rs +++ b/crates/gitbutler-tauri/src/main.rs @@ -82,7 +82,7 @@ fn main() { // SAFETY(qix-): This is safe because we're initializing the askpass broker here, // SAFETY(qix-): before any other threads would ever access it. unsafe { - gitbutler_core::askpass::init({ + gitbutler_repo::askpass::init({ let handle = app_handle.clone(); move |event| { handle.emit_all("git_prompt", event).expect("tauri event emission doesn't fail in practice")