mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-23 09:33:01 +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"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[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.
|
# 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 = [] }
|
gix = { git = "https://github.com/Byron/gitoxide", rev = "29898e3010bd3332418c683f2ac96aff5c8e72fa", default-features = false, features = [] }
|
||||||
git2 = { version = "0.18.3", features = [
|
git2 = { version = "0.18.3", features = [
|
||||||
|
@ -26,7 +26,7 @@ gitbutler-fs.workspace = true
|
|||||||
gitbutler-diff.workspace = true
|
gitbutler-diff.workspace = true
|
||||||
gitbutler-operating-modes.workspace = true
|
gitbutler-operating-modes.workspace = true
|
||||||
serde = { workspace = true, features = ["std"] }
|
serde = { workspace = true, features = ["std"] }
|
||||||
bstr = "1.10.0"
|
bstr.workspace = true
|
||||||
diffy = "0.4.0"
|
diffy = "0.4.0"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
regex = "1.10"
|
regex = "1.10"
|
||||||
|
@ -347,7 +347,6 @@ pub struct BranchListing {
|
|||||||
pub name: BranchIdentity,
|
pub name: BranchIdentity,
|
||||||
/// This is a list of remotes that this branch can be found on (e.g. `origin`, `upstream` etc.),
|
/// 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.
|
/// 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>,
|
pub remotes: Vec<BString>,
|
||||||
/// The branch may or may not have a virtual branch associated with it.
|
/// The branch may or may not have a virtual branch associated with it.
|
||||||
pub virtual_branch: Option<VirtualBranchReference>,
|
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
|
/// If the commit is referencing a specific change, this is its change id
|
||||||
pub change_id: Option<String>,
|
pub change_id: Option<String>,
|
||||||
/// The commit message
|
/// The commit message
|
||||||
#[serde(serialize_with = "gitbutler_serde::as_string_lossy")]
|
|
||||||
pub description: BString,
|
pub description: BString,
|
||||||
/// The timestamp of the commit in milliseconds
|
/// The timestamp of the commit in milliseconds
|
||||||
pub created_at: u128,
|
pub created_at: u128,
|
||||||
|
@ -23,7 +23,6 @@ use crate::{
|
|||||||
pub struct VirtualBranchCommit {
|
pub struct VirtualBranchCommit {
|
||||||
#[serde(with = "gitbutler_serde::oid")]
|
#[serde(with = "gitbutler_serde::oid")]
|
||||||
pub id: git2::Oid,
|
pub id: git2::Oid,
|
||||||
#[serde(serialize_with = "gitbutler_serde::as_string_lossy")]
|
|
||||||
pub description: BString,
|
pub description: BString,
|
||||||
pub created_at: u128,
|
pub created_at: u128,
|
||||||
pub author: Author,
|
pub author: Author,
|
||||||
|
@ -24,7 +24,6 @@ use serde::Serialize;
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct VirtualBranchHunk {
|
pub struct VirtualBranchHunk {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
#[serde(serialize_with = "gitbutler_serde::as_string_lossy")]
|
|
||||||
pub diff: BString,
|
pub diff: BString,
|
||||||
pub modified_at: u128,
|
pub modified_at: u128,
|
||||||
pub file_path: PathBuf,
|
pub file_path: PathBuf,
|
||||||
|
@ -50,7 +50,6 @@ pub struct RemoteBranchData {
|
|||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct RemoteCommit {
|
pub struct RemoteCommit {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
#[serde(serialize_with = "gitbutler_serde::as_string_lossy")]
|
|
||||||
pub description: BString,
|
pub description: BString,
|
||||||
pub created_at: u128,
|
pub created_at: u128,
|
||||||
pub author: Author,
|
pub author: Author,
|
||||||
|
@ -18,7 +18,7 @@ gitbutler-diff.workspace = true
|
|||||||
itertools = "0.13"
|
itertools = "0.13"
|
||||||
toml = "0.8.15"
|
toml = "0.8.15"
|
||||||
serde = { workspace = true, features = ["std"] }
|
serde = { workspace = true, features = ["std"] }
|
||||||
bstr = "1.10.0"
|
bstr.workspace = true
|
||||||
md5 = "0.7.0"
|
md5 = "0.7.0"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
tracing = "0.1.40"
|
tracing = "0.1.40"
|
||||||
|
@ -7,5 +7,5 @@ publish = false
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
git2.workspace = true
|
git2.workspace = true
|
||||||
bstr = "1.10.0"
|
bstr.workspace = true
|
||||||
uuid.workspace = true
|
uuid.workspace = true
|
||||||
|
@ -7,7 +7,7 @@ publish = false
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
git2.workspace = true
|
git2.workspace = true
|
||||||
bstr = "1.10.0"
|
bstr.workspace = true
|
||||||
md5 = "0.7.0"
|
md5 = "0.7.0"
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
|
@ -49,7 +49,7 @@ pub struct GitHunk {
|
|||||||
pub new_start: u32,
|
pub new_start: u32,
|
||||||
pub new_lines: u32,
|
pub new_lines: u32,
|
||||||
/// The `+`, `-` or ` ` prefixed lines of the diff produced by `git2`, along with their line separator.
|
/// 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 diff_lines: BString,
|
||||||
pub binary: bool,
|
pub binary: bool,
|
||||||
pub change_type: ChangeType,
|
pub change_type: ChangeType,
|
||||||
|
@ -7,7 +7,7 @@ publish = false
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
serde = { workspace = true, features = ["std"]}
|
serde = { workspace = true, features = ["std"]}
|
||||||
bstr = "1.10.0"
|
bstr.workspace = true
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
gix = { workspace = true, features = ["dirwalk", "credentials", "parallel"] }
|
gix = { workspace = true, features = ["dirwalk", "credentials", "parallel"] }
|
||||||
walkdir = "2.5.0"
|
walkdir = "2.5.0"
|
||||||
|
@ -9,7 +9,7 @@ publish = false
|
|||||||
git2.workspace = true
|
git2.workspace = true
|
||||||
gix.workspace = true
|
gix.workspace = true
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
bstr = "1.10.0"
|
bstr.workspace = true
|
||||||
tokio = { workspace = true, features = [ "rt-multi-thread", "rt", "macros", "sync" ] }
|
tokio = { workspace = true, features = [ "rt-multi-thread", "rt", "macros", "sync" ] }
|
||||||
gitbutler-git.workspace = true
|
gitbutler-git.workspace = true
|
||||||
tracing = "0.1.40"
|
tracing = "0.1.40"
|
||||||
|
@ -8,4 +8,4 @@ publish = false
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
git2.workspace = true
|
git2.workspace = true
|
||||||
serde = { workspace = true, features = ["std"]}
|
serde = { workspace = true, features = ["std"]}
|
||||||
bstr = "1.10.0"
|
bstr.workspace = true
|
||||||
|
@ -1,21 +1,5 @@
|
|||||||
use bstr::{BString, ByteSlice};
|
|
||||||
use serde::Serialize;
|
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>
|
pub fn as_time_seconds_from_unix_epoch<S>(v: &git2::Time, s: S) -> Result<S::Ok, S::Error>
|
||||||
where
|
where
|
||||||
S: serde::Serializer,
|
S: serde::Serializer,
|
||||||
|
@ -8,4 +8,4 @@ publish = false
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
url = { version = "2.5.2", features = ["serde"] }
|
url = { version = "2.5.2", features = ["serde"] }
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
bstr = "1.10.0"
|
bstr.workspace = true
|
||||||
|
Loading…
Reference in New Issue
Block a user