move ReferenceName tagged string to gitbutler-reference crate

gitbutler-reference is where ReferenceName belongs. There are other thing in this crate that are not nice, but let's clean those up!
This commit is contained in:
Kiril Videlov 2024-07-10 16:48:59 +02:00
parent d010d56044
commit 87f956d871
No known key found for this signature in database
GPG Key ID: A4C733025427C471
13 changed files with 13 additions and 18 deletions

5
Cargo.lock generated
View File

@ -1972,7 +1972,6 @@ dependencies = [
"gitbutler-id",
"gitbutler-reference",
"gitbutler-serde",
"gitbutler-tagged-string",
"hex",
"itertools 0.13.0",
"lazy_static",
@ -2003,7 +2002,6 @@ dependencies = [
"gitbutler-reference",
"gitbutler-repo",
"gitbutler-serde",
"gitbutler-tagged-string",
"gitbutler-testsupport",
"gitbutler-time",
"gitbutler-url",
@ -2149,9 +2147,9 @@ dependencies = [
"gitbutler-branch",
"gitbutler-fs",
"gitbutler-project",
"gitbutler-reference",
"gitbutler-repo",
"gitbutler-serde",
"gitbutler-tagged-string",
"gix",
"itertools 0.13.0",
"pretty_assertions",
@ -2303,7 +2301,6 @@ dependencies = [
"gitbutler-repo",
"gitbutler-secret",
"gitbutler-storage",
"gitbutler-tagged-string",
"gitbutler-testsupport",
"gitbutler-user",
"gitbutler-watcher",

View File

@ -21,7 +21,6 @@ gitbutler-id.workspace = true
gitbutler-time.workspace = true
gitbutler-commit.workspace = true
gitbutler-url.workspace = true
gitbutler-tagged-string.workspace = true
serde = { workspace = true, features = ["std"] }
bstr = "1.9.1"
diffy = "0.3.0"

View File

@ -12,9 +12,9 @@ use gitbutler_oplog::{
snapshot::Snapshot,
};
use gitbutler_project::{FetchResult, Project};
use gitbutler_reference::ReferenceName;
use gitbutler_reference::{Refname, RemoteRefname};
use gitbutler_repo::{credentials::Helper, RepoActions, RepositoryExt};
use gitbutler_tagged_string::ReferenceName;
use std::path::Path;
use crate::{

View File

@ -9,9 +9,9 @@ use gitbutler_branch::target::Target;
use gitbutler_branch::VirtualBranchesHandle;
use gitbutler_command_context::ProjectRepository;
use gitbutler_project::FetchResult;
use gitbutler_reference::ReferenceName;
use gitbutler_reference::{Refname, RemoteRefname};
use gitbutler_repo::{LogUntil, RepoActions, RepositoryExt};
use gitbutler_tagged_string::ReferenceName;
use serde::Serialize;
use super::r#virtual as vb;

View File

@ -18,9 +18,9 @@ use gitbutler_command_context::ProjectRepository;
use gitbutler_commit::commit_headers::{CommitHeadersV2, HasCommitHeaders};
use gitbutler_error::error::Marker;
use gitbutler_oplog::snapshot::Snapshot;
use gitbutler_reference::ReferenceName;
use gitbutler_reference::{normalize_branch_name, Refname};
use gitbutler_repo::{rebase::cherry_rebase, RepoActions, RepositoryExt};
use gitbutler_tagged_string::ReferenceName;
use gitbutler_time::time::now_since_unix_epoch_ms;
pub struct BranchManager<'l> {

View File

@ -9,7 +9,6 @@ publish = false
anyhow = "1.0.86"
git2.workspace = true
gitbutler-reference.workspace = true
gitbutler-tagged-string.workspace = true
gitbutler-serde.workspace = true
gitbutler-id.workspace = true
gitbutler-error.workspace = true

View File

@ -1,5 +1,5 @@
use anyhow::{Context, Result};
use gitbutler_tagged_string::ReferenceName;
use gitbutler_reference::ReferenceName;
pub trait BranchExt {
fn reference_name(&self) -> Result<ReferenceName>;

View File

@ -19,7 +19,7 @@ gitbutler-project.workspace = true
gitbutler-branch.workspace = true
gitbutler-serde.workspace = true
gitbutler-fs.workspace = true
gitbutler-tagged-string.workspace = true
gitbutler-reference.workspace = true
[[test]]
name = "oplog"

View File

@ -1,7 +1,7 @@
use anyhow::Result;
use gitbutler_branch::branch::{Branch, BranchUpdateRequest};
use gitbutler_project::Project;
use gitbutler_tagged_string::ReferenceName;
use gitbutler_reference::ReferenceName;
use std::vec;
use crate::{

View File

@ -1,4 +1,5 @@
mod refname;
use gitbutler_tagged_string::TaggedString;
pub use refname::{LocalRefname, Refname, RemoteRefname, VirtualRefname};
use regex::Regex;
@ -6,3 +7,7 @@ pub fn normalize_branch_name(name: &str) -> String {
let pattern = Regex::new("[^A-Za-z0-9_/.#]+").unwrap();
pattern.replace_all(name, "-").to_string()
}
pub struct _ReferenceName;
/// The name of a reference ie. `refs/heads/master`
pub type ReferenceName = TaggedString<_ReferenceName>;

View File

@ -54,7 +54,3 @@ impl<T> fmt::Debug for TaggedString<T> {
self.0.fmt(f)
}
}
pub struct _ReferenceName;
/// The name of a reference ie. `refs/heads/master`
pub type ReferenceName = TaggedString<_ReferenceName>;

View File

@ -60,7 +60,6 @@ gitbutler-error.workspace = true
gitbutler-secret.workspace = true
gitbutler-id.workspace = true
gitbutler-storage.workspace = true
gitbutler-tagged-string.workspace = true
open = "5"
[dependencies.tauri]

View File

@ -10,8 +10,8 @@ pub mod commands {
use gitbutler_error::error::Code;
use gitbutler_project as projects;
use gitbutler_project::ProjectId;
use gitbutler_reference::ReferenceName;
use gitbutler_reference::{Refname, RemoteRefname};
use gitbutler_tagged_string::ReferenceName;
use tauri::{AppHandle, Manager};
use tracing::instrument;