Skip to content

Commit

Permalink
feat: add index-to-worktree status with rename tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Feb 28, 2024
1 parent df81577 commit ac926a1
Show file tree
Hide file tree
Showing 17 changed files with 1,224 additions and 13 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions gix-diff/tests/rewrites/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ fn copy_by_id() -> crate::Result {
let id = hex_to_id("2e65efe2a145dda7ee51d1741299f848e5bf752e");
let source_a = Source {
entry_mode: EntryKind::Blob.into(),
id: id,
id,
kind: SourceKind::Copy,
location: "a".into(),
change: &Change {
Expand Down Expand Up @@ -303,7 +303,7 @@ fn copy_by_50_percent_similarity() -> crate::Result {
let id = hex_to_id("78981922613b2afb6025042ff6bd878ac1994e85");
let source_a = Source {
entry_mode: EntryKind::Blob.into(),
id: id,
id,
kind: SourceKind::Copy,
location: "a".into(),
change: &Change {
Expand Down Expand Up @@ -480,7 +480,7 @@ fn rename_by_50_percent_similarity() -> crate::Result {
src.unwrap(),
Source {
entry_mode: EntryKind::Blob.into(),
id: id,
id,
kind: SourceKind::Rename,
location: "a".into(),
change: &Change {
Expand Down
14 changes: 13 additions & 1 deletion gix-status/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,29 @@ autotests = false
[lib]
doctest = false

[features]
## Add support for tracking rewrites along with checking for worktree modifications.
worktree-rewrites = ["dep:gix-dir", "dep:gix-diff"]

[dependencies]
gix-index = { version = "^0.30.0", path = "../gix-index" }
gix-fs = { version = "^0.10.0", path = "../gix-fs" }
gix-hash = { version = "^0.14.1", path = "../gix-hash" }
gix-object = { version = "^0.41.1", path = "../gix-object" }
gix-path = { version = "^0.10.6", path = "../gix-path" }
gix-features = { version = "^0.38.0", path = "../gix-features" }
gix-features = { version = "^0.38.0", path = "../gix-features", features = ["progress"] }
gix-filter = { version = "^0.10.0", path = "../gix-filter" }
gix-worktree = { version = "^0.31.0", path = "../gix-worktree", default-features = false, features = ["attributes"] }
gix-pathspec = { version = "^0.7.0", path = "../gix-pathspec" }

gix-dir = { version = "^0.1.0", path = "../gix-dir", optional = true }
gix-diff = { version = "^0.41.0", path = "../gix-diff", default-features = false, features = ["blob"], optional = true }

thiserror = "1.0.26"
filetime = "0.2.15"
bstr = { version = "1.3.0", default-features = false }

document-features = { version = "0.2.0", optional = true }

[package.metadata.docs.rs]
features = ["document-features", "worktree-rewrites"]
2 changes: 1 addition & 1 deletion gix-status/src/index_as_worktree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ pub use types::{Change, Conflict, Context, EntryStatus, Error, Options, Outcome,
mod recorder;
pub use recorder::{Record, Recorder};

pub(crate) mod function;
pub(super) mod function;
///
pub mod traits;
2 changes: 1 addition & 1 deletion gix-status/src/index_as_worktree/recorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::index_as_worktree::{EntryStatus, VisitEntry};
/// A record of a change.
///
/// It's created either if there is a conflict or a change, or both.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Record<'index, T, U> {
/// The index entry that is changed.
pub entry: &'index index::Entry,
Expand Down
3 changes: 3 additions & 0 deletions gix-status/src/index_as_worktree/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ pub struct Options {
#[derive(Clone)]
pub struct Context<'a> {
/// The pathspec to limit the amount of paths that are checked. Can be empty to allow all paths.
///
/// Note that these are expected to have a [commont_prefix()](gix_pathspec::Search::common_prefix()) according
/// to the prefix of the repository to efficiently limit the scope of the paths we process.
pub pathspec: gix_pathspec::Search,
/// A stack pre-configured to allow accessing attributes for each entry, as required for `filter`
/// and possibly pathspecs.
Expand Down
Loading

0 comments on commit ac926a1

Please sign in to comment.