mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-23 01:22:12 +03:00
remove unnecessary BString-related serde functions.
They are supported when the respective bstring feature is used.
This commit is contained in:
parent
8ed90644a1
commit
3043f099b7
@ -33,6 +33,7 @@ members = [
|
||||
resolver = "2"
|
||||
|
||||
[workspace.dependencies]
|
||||
bstr = { version = "1.10.0", features = ["serde"] }
|
||||
# Add the `tracing` or `tracing-detail` features to see more of gitoxide in the logs. Useful to see which programs it invokes.
|
||||
gix = { git = "https://github.com/Byron/gitoxide", rev = "29898e3010bd3332418c683f2ac96aff5c8e72fa", default-features = false, features = [] }
|
||||
git2 = { version = "0.18.3", features = [
|
||||
|
@ -26,7 +26,7 @@ gitbutler-fs.workspace = true
|
||||
gitbutler-diff.workspace = true
|
||||
gitbutler-operating-modes.workspace = true
|
||||
serde = { workspace = true, features = ["std"] }
|
||||
bstr = "1.10.0"
|
||||
bstr.workspace = true
|
||||
diffy = "0.4.0"
|
||||
hex = "0.4.3"
|
||||
regex = "1.10"
|
||||
|
@ -347,7 +347,6 @@ pub struct BranchListing {
|
||||
pub name: BranchIdentity,
|
||||
/// This is a list of remotes that this branch can be found on (e.g. `origin`, `upstream` etc.),
|
||||
/// by collecting remotes from all local branches with the same identity that have a tracking setup.
|
||||
#[serde(serialize_with = "gitbutler_serde::as_string_lossy_vec")]
|
||||
pub remotes: Vec<BString>,
|
||||
/// The branch may or may not have a virtual branch associated with it.
|
||||
pub virtual_branch: Option<VirtualBranchReference>,
|
||||
@ -573,7 +572,6 @@ pub struct CommitEntry {
|
||||
/// If the commit is referencing a specific change, this is its change id
|
||||
pub change_id: Option<String>,
|
||||
/// The commit message
|
||||
#[serde(serialize_with = "gitbutler_serde::as_string_lossy")]
|
||||
pub description: BString,
|
||||
/// The timestamp of the commit in milliseconds
|
||||
pub created_at: u128,
|
||||
|
@ -23,7 +23,6 @@ use crate::{
|
||||
pub struct VirtualBranchCommit {
|
||||
#[serde(with = "gitbutler_serde::oid")]
|
||||
pub id: git2::Oid,
|
||||
#[serde(serialize_with = "gitbutler_serde::as_string_lossy")]
|
||||
pub description: BString,
|
||||
pub created_at: u128,
|
||||
pub author: Author,
|
||||
|
@ -24,7 +24,6 @@ use serde::Serialize;
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct VirtualBranchHunk {
|
||||
pub id: String,
|
||||
#[serde(serialize_with = "gitbutler_serde::as_string_lossy")]
|
||||
pub diff: BString,
|
||||
pub modified_at: u128,
|
||||
pub file_path: PathBuf,
|
||||
|
@ -50,7 +50,6 @@ pub struct RemoteBranchData {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct RemoteCommit {
|
||||
pub id: String,
|
||||
#[serde(serialize_with = "gitbutler_serde::as_string_lossy")]
|
||||
pub description: BString,
|
||||
pub created_at: u128,
|
||||
pub author: Author,
|
||||
|
@ -18,7 +18,7 @@ gitbutler-diff.workspace = true
|
||||
itertools = "0.13"
|
||||
toml = "0.8.15"
|
||||
serde = { workspace = true, features = ["std"] }
|
||||
bstr = "1.10.0"
|
||||
bstr.workspace = true
|
||||
md5 = "0.7.0"
|
||||
hex = "0.4.3"
|
||||
tracing = "0.1.40"
|
||||
|
@ -7,5 +7,5 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
git2.workspace = true
|
||||
bstr = "1.10.0"
|
||||
bstr.workspace = true
|
||||
uuid.workspace = true
|
||||
|
@ -7,7 +7,7 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
git2.workspace = true
|
||||
bstr = "1.10.0"
|
||||
bstr.workspace = true
|
||||
md5 = "0.7.0"
|
||||
anyhow = "1.0.86"
|
||||
hex = "0.4.3"
|
||||
|
@ -49,7 +49,7 @@ pub struct GitHunk {
|
||||
pub new_start: u32,
|
||||
pub new_lines: u32,
|
||||
/// The `+`, `-` or ` ` prefixed lines of the diff produced by `git2`, along with their line separator.
|
||||
#[serde(rename = "diff", serialize_with = "gitbutler_serde::as_string_lossy")]
|
||||
#[serde(rename = "diff")]
|
||||
pub diff_lines: BString,
|
||||
pub binary: bool,
|
||||
pub change_type: ChangeType,
|
||||
|
@ -7,7 +7,7 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true, features = ["std"]}
|
||||
bstr = "1.10.0"
|
||||
bstr.workspace = true
|
||||
anyhow = "1.0.86"
|
||||
gix = { workspace = true, features = ["dirwalk", "credentials", "parallel"] }
|
||||
walkdir = "2.5.0"
|
||||
|
@ -9,7 +9,7 @@ publish = false
|
||||
git2.workspace = true
|
||||
gix.workspace = true
|
||||
anyhow = "1.0.86"
|
||||
bstr = "1.10.0"
|
||||
bstr.workspace = true
|
||||
tokio = { workspace = true, features = [ "rt-multi-thread", "rt", "macros", "sync" ] }
|
||||
gitbutler-git.workspace = true
|
||||
tracing = "0.1.40"
|
||||
|
@ -8,4 +8,4 @@ publish = false
|
||||
[dependencies]
|
||||
git2.workspace = true
|
||||
serde = { workspace = true, features = ["std"]}
|
||||
bstr = "1.10.0"
|
||||
bstr.workspace = true
|
||||
|
@ -1,21 +1,5 @@
|
||||
use bstr::{BString, ByteSlice};
|
||||
use serde::Serialize;
|
||||
|
||||
pub fn as_string_lossy<S>(v: &BString, s: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
v.to_str_lossy().serialize(s)
|
||||
}
|
||||
|
||||
pub fn as_string_lossy_vec<S>(v: &[BString], s: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
let vec: Vec<String> = v.iter().map(|v| v.to_string()).collect();
|
||||
vec.serialize(s)
|
||||
}
|
||||
|
||||
pub fn as_time_seconds_from_unix_epoch<S>(v: &git2::Time, s: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
|
@ -8,4 +8,4 @@ publish = false
|
||||
[dependencies]
|
||||
url = { version = "2.5.2", features = ["serde"] }
|
||||
thiserror.workspace = true
|
||||
bstr = "1.10.0"
|
||||
bstr.workspace = true
|
||||
|
Loading…
Reference in New Issue
Block a user