Skip to content

Commit 977346e

Browse files
committed
Merge branch 'cargo-fixes'
2 parents fe24c89 + 54ac559 commit 977346e

File tree

17 files changed

+185
-66
lines changed

17 files changed

+185
-66
lines changed

Cargo.lock

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

gix-diff/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ doctest = false
2626
gix-hash = { version = "^0.14.2", path = "../gix-hash" }
2727
gix-object = { version = "^0.42.0", path = "../gix-object" }
2828
gix-filter = { version = "^0.11.1", path = "../gix-filter", optional = true }
29-
gix-worktree = { version = "^0.33.0", path = "../gix-worktree", default-features = false, features = ["attributes"], optional = true }
29+
gix-worktree = { version = "^0.33.1", path = "../gix-worktree", default-features = false, features = ["attributes"], optional = true }
3030
gix-command = { version = "^0.3.6", path = "../gix-command", optional = true }
3131
gix-path = { version = "^0.10.7", path = "../gix-path", optional = true }
3232
gix-fs = { version = "^0.10.2", path = "../gix-fs", optional = true }

gix-dir/CHANGELOG.md

+35-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,39 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.4.1 (2024-04-18)
9+
10+
### Bug Fixes
11+
12+
- <csr-id-7f2f3ff8adbecd631c2b4513995d6c94b21742eb/> assure worktree-roots aren't pruned with pathspecs that are never meant for them.
13+
Previously, when pathspecs were defined, the classification of the worktree-root
14+
would also be using them. This means that depending on the pathspec, worktree-roots would
15+
be pruned, which in turn makes it impossible to recurse into them.
16+
17+
Now pathspecs are disabled when classifying the worktree-root directory.
18+
19+
### Commit Statistics
20+
21+
<csr-read-only-do-not-edit/>
22+
23+
- 4 commits contributed to the release over the course of 4 calendar days.
24+
- 5 days passed between releases.
25+
- 1 commit was understood as [conventional](https://www.conventionalcommits.org).
26+
- 0 issues like '(#ID)' were seen in commit messages
27+
28+
### Commit Details
29+
30+
<csr-read-only-do-not-edit/>
31+
32+
<details><summary>view details</summary>
33+
34+
* **Uncategorized**
35+
- Prepare changelog prior to `gix-dir` patch release ([`6ca6fa6`](https://github.com/Byron/gitoxide/commit/6ca6fa69b5c21c8d8e9e07e21558e98201504cda))
36+
- Assure worktree-roots aren't pruned with pathspecs that are never meant for them. ([`7f2f3ff`](https://github.com/Byron/gitoxide/commit/7f2f3ff8adbecd631c2b4513995d6c94b21742eb))
37+
- Merge pull request #1345 from EliahKagan/shell-scripts ([`fe24c89`](https://github.com/Byron/gitoxide/commit/fe24c89e326670deaa3aaa643276d612d866072e))
38+
- Add missing +x bit on scripts that are run and not sourced ([`41bf65a`](https://github.com/Byron/gitoxide/commit/41bf65adef6f7d2cdd28fede262173ec7ba10822))
39+
</details>
40+
841
## 0.4.0 (2024-04-13)
942

1043
A maintenance release without user-facing changes.
@@ -13,7 +46,7 @@ A maintenance release without user-facing changes.
1346

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

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

2760
* **Uncategorized**
61+
- 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))
2862
- Prepare changelogs prior to release ([`5755271`](https://github.com/Byron/gitoxide/commit/57552717f46f96c35ba4ddc0a64434354ef845e9))
2963
- Merge pull request #1341 from szepeviktor/typos ([`55f379b`](https://github.com/Byron/gitoxide/commit/55f379bc47065822d078393d83d30c0835a89782))
3064
- Fix typos ([`f72ecce`](https://github.com/Byron/gitoxide/commit/f72ecce45babcad2a0c9b73c79d01ff502907a57))

gix-dir/Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "gix-dir"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
repository = "https://github.com/Byron/gitoxide"
55
license = "MIT OR Apache-2.0"
66
description = "A crate of the gitoxide project dealing with directory walks"
@@ -13,12 +13,12 @@ doctest = false
1313

1414
[dependencies]
1515
gix-trace = { version = "^0.1.9", path = "../gix-trace" }
16-
gix-index = { version = "^0.32.0", path = "../gix-index" }
16+
gix-index = { version = "^0.32.1", path = "../gix-index" }
1717
gix-discover = { version = "^0.31.0", path = "../gix-discover" }
1818
gix-fs = { version = "^0.10.2", path = "../gix-fs" }
1919
gix-path = { version = "^0.10.7", path = "../gix-path" }
20-
gix-pathspec = { version = "^0.7.3", path = "../gix-pathspec" }
21-
gix-worktree = { version = "^0.33.0", path = "../gix-worktree", default-features = false }
20+
gix-pathspec = { version = "^0.7.4", path = "../gix-pathspec" }
21+
gix-worktree = { version = "^0.33.1", path = "../gix-worktree", default-features = false }
2222
gix-object = { version = "^0.42.1", path = "../gix-object" }
2323
gix-ignore = { version = "^0.11.2", path = "../gix-ignore" }
2424
gix-utils = { version = "^0.1.12", path = "../gix-utils", features = ["bstr"] }

gix-dir/src/walk/classify.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ pub fn root(
2121
let mut path_buf = worktree_root.to_owned();
2222
// These initial values kick in if worktree_relative_root.is_empty();
2323
let file_kind = path_buf.symlink_metadata().map(|m| m.file_type().into()).ok();
24-
let mut out = path(&mut path_buf, buf, 0, file_kind, || None, options, ctx)?;
24+
let pathspec_orig = std::mem::replace(
25+
ctx.pathspec,
26+
gix_pathspec::Search::from_specs(None, None, "".as_ref()).expect("empty is valid"),
27+
);
28+
let res = path(&mut path_buf, buf, 0, file_kind, || None, options, ctx);
29+
*ctx.pathspec = pathspec_orig;
30+
let mut out = res?;
2531
let worktree_root_is_repository = out
2632
.disk_kind
2733
.map_or(false, |kind| matches!(kind, entry::Kind::Repository));
@@ -53,6 +59,9 @@ pub fn root(
5359
}
5460
last_length = Some(buf.len());
5561
}
62+
if out.pathspec_match.is_none() {
63+
out.pathspec_match = Some(PathspecMatch::Always);
64+
}
5665
Ok((out, worktree_root_is_repository))
5766
}
5867
/// The product of [`path()`] calls.

gix-dir/src/walk/function.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ pub fn walk(
6767
options,
6868
&mut ctx,
6969
)?;
70-
if !can_recurse(
70+
71+
let can_recurse = can_recurse(
7172
buf.as_bstr(),
7273
if root == worktree_root && root_info.disk_kind == Some(entry::Kind::Symlink) && current.is_dir() {
7374
classify::Outcome {
@@ -80,7 +81,8 @@ pub fn walk(
8081
options.for_deletion,
8182
worktree_root_is_repository,
8283
delegate,
83-
) {
84+
);
85+
if !can_recurse {
8486
if buf.is_empty() && !root_info.disk_kind.map_or(false, |kind| kind.is_dir()) {
8587
return Err(Error::WorktreeRootIsFile { root: root.to_owned() });
8688
}

gix-dir/tests/walk/mod.rs

+11-15
Original file line numberDiff line numberDiff line change
@@ -2732,7 +2732,7 @@ fn worktree_root_can_be_symlink() -> crate::Result {
27322732
#[test]
27332733
fn root_may_not_go_through_dot_git() -> crate::Result {
27342734
let root = fixture("with-nested-dot-git");
2735-
for (dir, expected_pathspec) in [("", Some(Verbatim)), ("subdir", None)] {
2735+
for (dir, expected_pathspec) in [("", Verbatim), ("subdir", Always)] {
27362736
let troot = root.join("dir").join(".git").join(dir);
27372737
let ((out, _root), entries) = collect(&root, Some(&troot), |keep, ctx| {
27382738
walk(&root, ctx, options_emit_all(), keep)
@@ -2747,12 +2747,10 @@ fn root_may_not_go_through_dot_git() -> crate::Result {
27472747
);
27482748
assert_eq!(
27492749
entries,
2750-
[{
2751-
let mut e = entry("dir/.git", Pruned, Directory).with_property(DotGit);
2752-
e.0.pathspec_match = expected_pathspec;
2753-
e
2754-
}],
2755-
"no traversal happened as root passes though .git"
2750+
[entry("dir/.git", Pruned, Directory)
2751+
.with_property(DotGit)
2752+
.with_match(expected_pathspec)],
2753+
"{dir}: no traversal happened as root passes though .git"
27562754
);
27572755
}
27582756
Ok(())
@@ -3167,7 +3165,7 @@ fn root_can_be_pruned_early_with_pathspec() -> crate::Result {
31673165

31683166
assert_eq!(
31693167
entries,
3170-
[entry_nomatch("dir", Pruned, Directory)],
3168+
[entry("dir", Pruned, Directory)],
31713169
"the pathspec didn't match the root, early abort"
31723170
);
31733171
Ok(())
@@ -3929,7 +3927,7 @@ fn untracked_and_ignored_collapse_mix() {
39293927
#[test]
39303928
fn root_cannot_pass_through_case_altered_capital_dot_git_if_case_insensitive() -> crate::Result {
39313929
let root = fixture("with-nested-capitalized-dot-git");
3932-
for (dir, expected_pathspec) in [("", Some(Verbatim)), ("subdir", None)] {
3930+
for (dir, expected_pathspec) in [("", Verbatim), ("subdir", Always)] {
39333931
let troot = root.join("dir").join(".GIT").join(dir);
39343932
let ((out, _root), entries) = collect(&root, Some(&troot), |keep, ctx| {
39353933
walk(
@@ -3952,12 +3950,10 @@ fn root_cannot_pass_through_case_altered_capital_dot_git_if_case_insensitive() -
39523950
);
39533951
assert_eq!(
39543952
entries,
3955-
[{
3956-
let mut e = entry("dir/.GIT", Pruned, Directory).with_property(DotGit);
3957-
e.0.pathspec_match = expected_pathspec;
3958-
e
3959-
}],
3960-
"no traversal happened as root passes though .git, it compares in a case-insensitive fashion"
3953+
[entry("dir/.GIT", Pruned, Directory)
3954+
.with_property(DotGit)
3955+
.with_match(expected_pathspec)],
3956+
"{dir}: no traversal happened as root passes though .git, it compares in a case-insensitive fashion"
39613957
);
39623958
}
39633959

0 commit comments

Comments
 (0)