mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-28 12:05:22 +03:00
move normalize_branch_name to core
This commit is contained in:
parent
948c89e8be
commit
ce130dcf12
@ -16,14 +16,15 @@ use git2::build::TreeUpdateBuilder;
|
||||
use git2::ErrorCode;
|
||||
use git2_hooks::HookResult;
|
||||
use hex::ToHex;
|
||||
use regex::Regex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use gitbutler_core::error::Code;
|
||||
use gitbutler_core::error::Marker;
|
||||
use gitbutler_core::git::diff::GitHunk;
|
||||
use gitbutler_core::git::diff::{diff_files_into_hunks, trees, FileDiff};
|
||||
use gitbutler_core::git::{CommitExt, CommitHeadersV2, HasCommitHeaders, RepositoryExt};
|
||||
use gitbutler_core::git::{
|
||||
normalize_branch_name, CommitExt, CommitHeadersV2, HasCommitHeaders, RepositoryExt,
|
||||
};
|
||||
use gitbutler_core::rebase::{cherry_rebase, cherry_rebase_group};
|
||||
use gitbutler_core::time::now_since_unix_epoch_ms;
|
||||
use gitbutler_core::virtual_branches::branch::HunkHash;
|
||||
@ -230,11 +231,6 @@ pub enum NameConflitResolution {
|
||||
Overwrite,
|
||||
}
|
||||
|
||||
pub fn normalize_branch_name(name: &str) -> String {
|
||||
let pattern = Regex::new("[^A-Za-z0-9_/.#]+").unwrap();
|
||||
pattern.replace_all(name, "-").to_string()
|
||||
}
|
||||
|
||||
pub fn unapply_ownership(
|
||||
project_repository: &project_repository::Repository,
|
||||
ownership: &BranchOwnershipClaims,
|
||||
|
@ -1,2 +1,8 @@
|
||||
mod refname;
|
||||
pub use refname::{LocalRefname, Refname, RemoteRefname, VirtualRefname};
|
||||
use regex::Regex;
|
||||
|
||||
pub fn normalize_branch_name(name: &str) -> String {
|
||||
let pattern = Regex::new("[^A-Za-z0-9_/.#]+").unwrap();
|
||||
pattern.replace_all(name, "-").to_string()
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use std::{fmt, str::FromStr};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::error::Error;
|
||||
use crate::virtual_branches::{normalize_branch_name, Branch};
|
||||
use crate::{git::normalize_branch_name, virtual_branches::Branch};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct Refname {
|
||||
|
Loading…
Reference in New Issue
Block a user