From 0b1ecf7b54c438b8b8bb917b46514651121a9ba9 Mon Sep 17 00:00:00 2001 From: Kiril Videlov Date: Tue, 9 Jul 2024 00:45:10 +0200 Subject: [PATCH] move virtual branch constatns out of the core create --- Cargo.lock | 1 + crates/gitbutler-branch/Cargo.toml | 1 + crates/gitbutler-branch/src/lib.rs | 9 +++++++++ crates/gitbutler-core/src/lib.rs | 1 - crates/gitbutler-core/src/virtual_branches/mod.rs | 8 -------- crates/gitbutler-oplog/src/oplog.rs | 2 +- crates/gitbutler-oplog/src/reflog.rs | 8 +++----- crates/gitbutler-virtual/src/base.rs | 2 +- crates/gitbutler-virtual/src/integration.rs | 8 ++++---- 9 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 crates/gitbutler-core/src/virtual_branches/mod.rs diff --git a/Cargo.lock b/Cargo.lock index d5515d930..8418b7d74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2112,6 +2112,7 @@ dependencies = [ "gitbutler-core", "hex", "itertools 0.13.0", + "lazy_static", "md5", "serde", "tracing", diff --git a/crates/gitbutler-branch/Cargo.toml b/crates/gitbutler-branch/Cargo.toml index 1653cd81f..5c801b6d4 100644 --- a/crates/gitbutler-branch/Cargo.toml +++ b/crates/gitbutler-branch/Cargo.toml @@ -15,6 +15,7 @@ bstr = "1.9.1" md5 = "0.7.0" hex = "0.4.3" tracing = "0.1.40" +lazy_static = "1.4.0" [[test]] name="branch" diff --git a/crates/gitbutler-branch/src/lib.rs b/crates/gitbutler-branch/src/lib.rs index a971537a5..60aa24c00 100644 --- a/crates/gitbutler-branch/src/lib.rs +++ b/crates/gitbutler-branch/src/lib.rs @@ -5,3 +5,12 @@ pub mod hunk; pub mod ownership; pub mod serde; pub mod target; + +use lazy_static::lazy_static; +lazy_static! { + pub static ref GITBUTLER_INTEGRATION_REFERENCE: gitbutler_core::git::LocalRefname = + gitbutler_core::git::LocalRefname::new("gitbutler/integration", None); +} + +pub const GITBUTLER_INTEGRATION_COMMIT_AUTHOR_NAME: &str = "GitButler"; +pub const GITBUTLER_INTEGRATION_COMMIT_AUTHOR_EMAIL: &str = "gitbutler@gitbutler.com"; diff --git a/crates/gitbutler-core/src/lib.rs b/crates/gitbutler-core/src/lib.rs index 586e441ba..a75adbd11 100644 --- a/crates/gitbutler-core/src/lib.rs +++ b/crates/gitbutler-core/src/lib.rs @@ -26,6 +26,5 @@ pub mod ssh; pub mod storage; pub mod time; pub mod types; -pub mod virtual_branches; #[cfg(target_os = "windows")] pub mod windows; diff --git a/crates/gitbutler-core/src/virtual_branches/mod.rs b/crates/gitbutler-core/src/virtual_branches/mod.rs deleted file mode 100644 index 6e7d905e4..000000000 --- a/crates/gitbutler-core/src/virtual_branches/mod.rs +++ /dev/null @@ -1,8 +0,0 @@ -use lazy_static::lazy_static; -lazy_static! { - pub static ref GITBUTLER_INTEGRATION_REFERENCE: crate::git::LocalRefname = - crate::git::LocalRefname::new("gitbutler/integration", None); -} - -pub const GITBUTLER_INTEGRATION_COMMIT_AUTHOR_NAME: &str = "GitButler"; -pub const GITBUTLER_INTEGRATION_COMMIT_AUTHOR_EMAIL: &str = "gitbutler@gitbutler.com"; diff --git a/crates/gitbutler-oplog/src/oplog.rs b/crates/gitbutler-oplog/src/oplog.rs index d2211d460..6a1d0cd62 100644 --- a/crates/gitbutler-oplog/src/oplog.rs +++ b/crates/gitbutler-oplog/src/oplog.rs @@ -14,7 +14,7 @@ use std::{fs, path::PathBuf}; use anyhow::Result; use tracing::instrument; -use gitbutler_core::virtual_branches::{ +use gitbutler_branch::{ GITBUTLER_INTEGRATION_COMMIT_AUTHOR_EMAIL, GITBUTLER_INTEGRATION_COMMIT_AUTHOR_NAME, }; diff --git a/crates/gitbutler-oplog/src/reflog.rs b/crates/gitbutler-oplog/src/reflog.rs index 920a21b9c..c462be5cb 100644 --- a/crates/gitbutler-oplog/src/reflog.rs +++ b/crates/gitbutler-oplog/src/reflog.rs @@ -1,10 +1,8 @@ use anyhow::{Context, Result}; -use gitbutler_core::{ - fs::write, - virtual_branches::{ - GITBUTLER_INTEGRATION_COMMIT_AUTHOR_EMAIL, GITBUTLER_INTEGRATION_COMMIT_AUTHOR_NAME, - }, +use gitbutler_branch::{ + GITBUTLER_INTEGRATION_COMMIT_AUTHOR_EMAIL, GITBUTLER_INTEGRATION_COMMIT_AUTHOR_NAME, }; +use gitbutler_core::fs::write; use gix::config::tree::Key; use std::path::Path; diff --git a/crates/gitbutler-virtual/src/base.rs b/crates/gitbutler-virtual/src/base.rs index 7d19cf2e6..90930a194 100644 --- a/crates/gitbutler-virtual/src/base.rs +++ b/crates/gitbutler-virtual/src/base.rs @@ -18,9 +18,9 @@ use crate::conflicts::RepoConflicts; use crate::integration::{get_workspace_head, update_gitbutler_integration}; use crate::remote::{commit_to_remote_commit, RemoteCommit}; use crate::VirtualBranchHunk; +use gitbutler_branch::GITBUTLER_INTEGRATION_REFERENCE; use gitbutler_core::error::Marker; use gitbutler_core::git; -use gitbutler_core::virtual_branches::GITBUTLER_INTEGRATION_REFERENCE; use gitbutler_repo::rebase::cherry_rebase; #[derive(Debug, Serialize, PartialEq, Clone)] diff --git a/crates/gitbutler-virtual/src/integration.rs b/crates/gitbutler-virtual/src/integration.rs index 42a987b6e..fda40065e 100644 --- a/crates/gitbutler-virtual/src/integration.rs +++ b/crates/gitbutler-virtual/src/integration.rs @@ -4,14 +4,14 @@ use anyhow::{anyhow, bail, Context, Result}; use bstr::ByteSlice; use gitbutler_branch::branch::BranchCreateRequest; +use gitbutler_branch::{ + GITBUTLER_INTEGRATION_COMMIT_AUTHOR_EMAIL, GITBUTLER_INTEGRATION_COMMIT_AUTHOR_NAME, + GITBUTLER_INTEGRATION_REFERENCE, +}; use gitbutler_branchstate::{VirtualBranchesAccess, VirtualBranchesHandle}; use gitbutler_command_context::ProjectRepo; use gitbutler_core::error::Marker; use gitbutler_core::git::CommitExt; -use gitbutler_core::virtual_branches::{ - GITBUTLER_INTEGRATION_COMMIT_AUTHOR_EMAIL, GITBUTLER_INTEGRATION_COMMIT_AUTHOR_NAME, - GITBUTLER_INTEGRATION_REFERENCE, -}; use gitbutler_repo::{LogUntil, RepoActions, RepositoryExt}; use crate::conflicts;