[package]
license = "Apache-2.0"
name = "kigi-fast-worktree"
version.workspace = true
edition.workspace = true
description = "High-performance git worktree creation using CoW cloning"

[[bin]]
name = "fast-worktree"
path = "src/bin/cli.rs"

[[bin]]
name = "pool-perf-bench"
path = "src/bin/pool_perf_bench.rs"
required-features = ["bench"]

[features]
default-bazel = ["metadata"]
bench = ["dep:tempfile"]
# SQLite metadata DB for worktree tracking. On Linux, serde/serde_json are
# already pulled in unconditionally (overlay metadata), so this feature
# effectively only gates rusqlite there.
metadata = ["dep:rusqlite", "dep:serde", "dep:serde_json", "dep:kigi-sqlite-journal"]

[dependencies]
anyhow = { workspace = true }
bytes = { workspace = true }
clap = { workspace = true }
crossbeam = { workspace = true }
dashmap = { workspace = true }
dunce = { workspace = true }
gix = { workspace = true, features = ["status", "parallel"] }
gix-status = { version = "0.30.0" }
globset = { workspace = true }
ignore = { workspace = true }
num_cpus = { workspace = true }

reflink-copy = { workspace = true }
rapidhash = "4.2.0"
rusqlite = { version = "0.37", features = ["bundled"], optional = true }
serde = { workspace = true, features = ["derive"], optional = true }
serde_json = { workspace = true, optional = true }
tokio-util = { workspace = true }
tempfile = { workspace = true, optional = true }
tracing = { workspace = true }
kigi-gix-status = { workspace = true }
kigi-sqlite-journal = { workspace = true, optional = true }
kigi-tty-utils = { workspace = true }
tracing-subscriber = { workspace = true }

[dev-dependencies]
tempfile = { workspace = true }
serde_json = { workspace = true }
kigi-test-utils = { workspace = true }
# Unconditional because cargo doesn't support feature-gated dev-deps cleanly.
# Only used by tests behind #[cfg(feature = "metadata")] in db/tests.rs.
rusqlite = { version = "0.37", features = ["bundled"] }

[target.'cfg(target_os = "linux")'.dev-dependencies]
libc = { workspace = true }
nix = { version = "0.30", features = ["fs"] }

[target.'cfg(target_os = "linux")'.dependencies]
libc = { workspace = true }
nix = { version = "0.30", features = ["fs"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }

[lints]
workspace = true
