Skip to content

Commit ecd2e5e

Browse files
committed
Support for 'serde1' feature in git-worktree (#301)
1 parent eddead7 commit ecd2e5e

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

Cargo.lock

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ check: ## Build all code in suitable configurations
8686
cd git-object && cargo check --all-features \
8787
&& cargo check --features verbose-object-parsing-errors
8888
cd git-index && cargo check --features serde1
89+
cd git-worktree && cargo check --features serde1
8990
cd git-actor && cargo check --features serde1
9091
cd git-pack && cargo check --features serde1 \
9192
&& cargo check --features pack-cache-lru-static \

git-worktree/Cargo.toml

+12
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,30 @@ doctest = false
1212

1313
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1414

15+
[features]
16+
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
17+
serde1 = [ "serde", "bstr/serde1", "git-index/serde1", "git-hash/serde1", "git-object/serde1" ]
18+
1519
[dependencies]
1620
git-index = { version = "^0.1.0", path = "../git-index" }
1721
git-hash = { version = "^0.9.0", path = "../git-hash" }
1822
git-object = { version = "^0.17.0", path = "../git-object" }
1923
git-features = { version = "^0.19.1", path = "../git-features" }
2024

25+
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
26+
2127
quick-error = "2.0.1"
2228
bstr = { version = "0.2.13", default-features = false }
2329

30+
document-features = { version = "0.2.0", optional = true }
31+
2432
[dev-dependencies]
2533
git-testtools = { path = "../tests/tools" }
2634
git-odb = { path = "../git-odb" }
2735

2836
walkdir = "2.3.2"
2937
tempfile = "3.2.0"
38+
39+
[package.metadata.docs.rs]
40+
features = ["document-features"]
41+
all-features = true

git-worktree/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
/// file system related utilities
44
pub mod fs {
55
/// Common knowledge about the worktree that is needed across most interactions with the work tree
6+
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
7+
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
68
pub struct Context {
79
/// If true, the filesystem will store paths as decomposed unicode, i.e. `ä` becomes `"a\u{308}"`, which means that
810
/// we have to turn these forms back from decomposed to precomposed unicode before storing it in the index or generally

0 commit comments

Comments
 (0)