Skip to content

Commit

Permalink
Merge branch 'cargo-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Apr 18, 2024
2 parents fe24c89 + 54ac559 commit 977346e
Show file tree
Hide file tree
Showing 17 changed files with 185 additions and 66 deletions.
48 changes: 24 additions & 24 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion gix-diff/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ doctest = false
gix-hash = { version = "^0.14.2", path = "../gix-hash" }
gix-object = { version = "^0.42.0", path = "../gix-object" }
gix-filter = { version = "^0.11.1", path = "../gix-filter", optional = true }
gix-worktree = { version = "^0.33.0", path = "../gix-worktree", default-features = false, features = ["attributes"], optional = true }
gix-worktree = { version = "^0.33.1", path = "../gix-worktree", default-features = false, features = ["attributes"], optional = true }
gix-command = { version = "^0.3.6", path = "../gix-command", optional = true }
gix-path = { version = "^0.10.7", path = "../gix-path", optional = true }
gix-fs = { version = "^0.10.2", path = "../gix-fs", optional = true }
Expand Down
36 changes: 35 additions & 1 deletion gix-dir/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.4.1 (2024-04-18)

### Bug Fixes

- <csr-id-7f2f3ff8adbecd631c2b4513995d6c94b21742eb/> assure worktree-roots aren't pruned with pathspecs that are never meant for them.
Previously, when pathspecs were defined, the classification of the worktree-root
would also be using them. This means that depending on the pathspec, worktree-roots would
be pruned, which in turn makes it impossible to recurse into them.

Now pathspecs are disabled when classifying the worktree-root directory.

### Commit Statistics

<csr-read-only-do-not-edit/>

- 4 commits contributed to the release over the course of 4 calendar days.
- 5 days passed between releases.
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages

### Commit Details

<csr-read-only-do-not-edit/>

<details><summary>view details</summary>

* **Uncategorized**
- Prepare changelog prior to `gix-dir` patch release ([`6ca6fa6`](https://github.com/Byron/gitoxide/commit/6ca6fa69b5c21c8d8e9e07e21558e98201504cda))
- Assure worktree-roots aren't pruned with pathspecs that are never meant for them. ([`7f2f3ff`](https://github.com/Byron/gitoxide/commit/7f2f3ff8adbecd631c2b4513995d6c94b21742eb))
- Merge pull request #1345 from EliahKagan/shell-scripts ([`fe24c89`](https://github.com/Byron/gitoxide/commit/fe24c89e326670deaa3aaa643276d612d866072e))
- Add missing +x bit on scripts that are run and not sourced ([`41bf65a`](https://github.com/Byron/gitoxide/commit/41bf65adef6f7d2cdd28fede262173ec7ba10822))
</details>

## 0.4.0 (2024-04-13)

A maintenance release without user-facing changes.
Expand All @@ -13,7 +46,7 @@ A maintenance release without user-facing changes.

<csr-read-only-do-not-edit/>

- 5 commits contributed to the release over the course of 10 calendar days.
- 6 commits contributed to the release over the course of 10 calendar days.
- 26 days passed between releases.
- 0 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(#ID)' were seen in commit messages
Expand All @@ -25,6 +58,7 @@ A maintenance release without user-facing changes.
<details><summary>view details</summary>

* **Uncategorized**
- Release gix-trace v0.1.9, gix-utils v0.1.12, gix-packetline-blocking v0.17.4, gix-filter v0.11.1, gix-fs v0.10.2, gix-traverse v0.39.0, gix-worktree-stream v0.12.0, gix-archive v0.12.0, gix-config v0.36.1, gix-url v0.27.3, gix-index v0.32.0, gix-worktree v0.33.0, gix-diff v0.43.0, gix-pathspec v0.7.3, gix-dir v0.4.0, gix-pack v0.50.0, gix-odb v0.60.0, gix-transport v0.42.0, gix-protocol v0.45.0, gix-status v0.9.0, gix-worktree-state v0.10.0, gix v0.62.0, gix-fsck v0.4.0, gitoxide-core v0.37.0, gitoxide v0.35.0, safety bump 14 crates ([`095c673`](https://github.com/Byron/gitoxide/commit/095c6739b2722a8b9af90776b435ef2da454c0e6))
- Prepare changelogs prior to release ([`5755271`](https://github.com/Byron/gitoxide/commit/57552717f46f96c35ba4ddc0a64434354ef845e9))
- Merge pull request #1341 from szepeviktor/typos ([`55f379b`](https://github.com/Byron/gitoxide/commit/55f379bc47065822d078393d83d30c0835a89782))
- Fix typos ([`f72ecce`](https://github.com/Byron/gitoxide/commit/f72ecce45babcad2a0c9b73c79d01ff502907a57))
Expand Down
8 changes: 4 additions & 4 deletions gix-dir/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gix-dir"
version = "0.4.0"
version = "0.4.1"
repository = "https://github.com/Byron/gitoxide"
license = "MIT OR Apache-2.0"
description = "A crate of the gitoxide project dealing with directory walks"
Expand All @@ -13,12 +13,12 @@ doctest = false

[dependencies]
gix-trace = { version = "^0.1.9", path = "../gix-trace" }
gix-index = { version = "^0.32.0", path = "../gix-index" }
gix-index = { version = "^0.32.1", path = "../gix-index" }
gix-discover = { version = "^0.31.0", path = "../gix-discover" }
gix-fs = { version = "^0.10.2", path = "../gix-fs" }
gix-path = { version = "^0.10.7", path = "../gix-path" }
gix-pathspec = { version = "^0.7.3", path = "../gix-pathspec" }
gix-worktree = { version = "^0.33.0", path = "../gix-worktree", default-features = false }
gix-pathspec = { version = "^0.7.4", path = "../gix-pathspec" }
gix-worktree = { version = "^0.33.1", path = "../gix-worktree", default-features = false }
gix-object = { version = "^0.42.1", path = "../gix-object" }
gix-ignore = { version = "^0.11.2", path = "../gix-ignore" }
gix-utils = { version = "^0.1.12", path = "../gix-utils", features = ["bstr"] }
Expand Down
11 changes: 10 additions & 1 deletion gix-dir/src/walk/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ pub fn root(
let mut path_buf = worktree_root.to_owned();
// These initial values kick in if worktree_relative_root.is_empty();
let file_kind = path_buf.symlink_metadata().map(|m| m.file_type().into()).ok();
let mut out = path(&mut path_buf, buf, 0, file_kind, || None, options, ctx)?;
let pathspec_orig = std::mem::replace(
ctx.pathspec,
gix_pathspec::Search::from_specs(None, None, "".as_ref()).expect("empty is valid"),
);
let res = path(&mut path_buf, buf, 0, file_kind, || None, options, ctx);
*ctx.pathspec = pathspec_orig;
let mut out = res?;
let worktree_root_is_repository = out
.disk_kind
.map_or(false, |kind| matches!(kind, entry::Kind::Repository));
Expand Down Expand Up @@ -53,6 +59,9 @@ pub fn root(
}
last_length = Some(buf.len());
}
if out.pathspec_match.is_none() {
out.pathspec_match = Some(PathspecMatch::Always);
}
Ok((out, worktree_root_is_repository))
}
/// The product of [`path()`] calls.
Expand Down
6 changes: 4 additions & 2 deletions gix-dir/src/walk/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ pub fn walk(
options,
&mut ctx,
)?;
if !can_recurse(

let can_recurse = can_recurse(
buf.as_bstr(),
if root == worktree_root && root_info.disk_kind == Some(entry::Kind::Symlink) && current.is_dir() {
classify::Outcome {
Expand All @@ -80,7 +81,8 @@ pub fn walk(
options.for_deletion,
worktree_root_is_repository,
delegate,
) {
);
if !can_recurse {
if buf.is_empty() && !root_info.disk_kind.map_or(false, |kind| kind.is_dir()) {
return Err(Error::WorktreeRootIsFile { root: root.to_owned() });
}
Expand Down
26 changes: 11 additions & 15 deletions gix-dir/tests/walk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2732,7 +2732,7 @@ fn worktree_root_can_be_symlink() -> crate::Result {
#[test]
fn root_may_not_go_through_dot_git() -> crate::Result {
let root = fixture("with-nested-dot-git");
for (dir, expected_pathspec) in [("", Some(Verbatim)), ("subdir", None)] {
for (dir, expected_pathspec) in [("", Verbatim), ("subdir", Always)] {
let troot = root.join("dir").join(".git").join(dir);
let ((out, _root), entries) = collect(&root, Some(&troot), |keep, ctx| {
walk(&root, ctx, options_emit_all(), keep)
Expand All @@ -2747,12 +2747,10 @@ fn root_may_not_go_through_dot_git() -> crate::Result {
);
assert_eq!(
entries,
[{
let mut e = entry("dir/.git", Pruned, Directory).with_property(DotGit);
e.0.pathspec_match = expected_pathspec;
e
}],
"no traversal happened as root passes though .git"
[entry("dir/.git", Pruned, Directory)
.with_property(DotGit)
.with_match(expected_pathspec)],
"{dir}: no traversal happened as root passes though .git"
);
}
Ok(())
Expand Down Expand Up @@ -3167,7 +3165,7 @@ fn root_can_be_pruned_early_with_pathspec() -> crate::Result {

assert_eq!(
entries,
[entry_nomatch("dir", Pruned, Directory)],
[entry("dir", Pruned, Directory)],
"the pathspec didn't match the root, early abort"
);
Ok(())
Expand Down Expand Up @@ -3929,7 +3927,7 @@ fn untracked_and_ignored_collapse_mix() {
#[test]
fn root_cannot_pass_through_case_altered_capital_dot_git_if_case_insensitive() -> crate::Result {
let root = fixture("with-nested-capitalized-dot-git");
for (dir, expected_pathspec) in [("", Some(Verbatim)), ("subdir", None)] {
for (dir, expected_pathspec) in [("", Verbatim), ("subdir", Always)] {
let troot = root.join("dir").join(".GIT").join(dir);
let ((out, _root), entries) = collect(&root, Some(&troot), |keep, ctx| {
walk(
Expand All @@ -3952,12 +3950,10 @@ fn root_cannot_pass_through_case_altered_capital_dot_git_if_case_insensitive() -
);
assert_eq!(
entries,
[{
let mut e = entry("dir/.GIT", Pruned, Directory).with_property(DotGit);
e.0.pathspec_match = expected_pathspec;
e
}],
"no traversal happened as root passes though .git, it compares in a case-insensitive fashion"
[entry("dir/.GIT", Pruned, Directory)
.with_property(DotGit)
.with_match(expected_pathspec)],
"{dir}: no traversal happened as root passes though .git, it compares in a case-insensitive fashion"
);
}

Expand Down
Loading

0 comments on commit 977346e

Please sign in to comment.