Skip to content

Commit 5d176fc

Browse files
committed
Merge branch 'dirwalk'
2 parents 4138902 + f6e4bba commit 5d176fc

File tree

56 files changed

+1154
-111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1154
-111
lines changed

Cargo.lock

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gix-discover/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ gix-sec = { version = "^0.10.3", path = "../gix-sec" }
1717
gix-path = { version = "^0.10.3", path = "../gix-path" }
1818
gix-ref = { version = "^0.40.1", path = "../gix-ref" }
1919
gix-hash = { version = "^0.14.1", path = "../gix-hash" }
20+
gix-fs = { version = "^0.9.1", path = "../gix-fs" }
2021

2122
bstr = { version = "1.3.0", default-features = false, features = ["std", "unicode"] }
2223
thiserror = "1.0.26"

gix-discover/src/is.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ pub(crate) fn git_with_metadata(
177177
dot_git.as_ref().into(),
178178
gix_ref::store::WriteReflog::Normal,
179179
object_hash_should_not_matter_here,
180+
false,
180181
);
181182
let head = refs.find_loose("HEAD")?;
182183
if head.name.as_bstr() != "HEAD" {

gix-discover/src/upwards/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ pub(crate) mod function {
3939
// us the parent directory. (`Path::parent` just strips off the last
4040
// path component, which means it will not do what you expect when
4141
// working with paths paths that contain '..'.)
42-
let cwd = current_dir.map_or_else(|| std::env::current_dir().map(Cow::Owned), |cwd| Ok(Cow::Borrowed(cwd)))?;
42+
let cwd = current_dir.map_or_else(
43+
|| {
44+
// The paths we return are relevant to the repository, but at this time it's impossible to know
45+
// what `core.precomposeUnicode` is going to be. Hence the one using these paths will have to
46+
// transform the paths as needed, because we can't. `false` means to leave the obtained path as is.
47+
gix_fs::current_dir(false).map(Cow::Owned)
48+
},
49+
|cwd| Ok(Cow::Borrowed(cwd)),
50+
)?;
4351
#[cfg(windows)]
4452
let directory = dunce::simplified(directory);
4553
let dir = gix_path::normalize(directory.into(), cwd.as_ref()).ok_or_else(|| Error::InvalidInput {

gix-discover/src/upwards/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ pub struct Options<'a> {
6363
/// that this is merely an optimization for those who discover a lot of repositories in the same process.
6464
///
6565
/// If unset, the current working directory will be obtained automatically.
66+
/// Note that the path here might or might not contained decomposed unicode, which may end up in a path
67+
/// relevant us, like the git-dir or the worktree-dir. However, when opening the repository, it will
68+
/// change decomposed unicode to precomposed unicode based on the value of `core.precomposeUnicode`, and we
69+
/// don't have to deal with that value here just yet.
6670
pub current_dir: Option<&'a std::path::Path>,
6771
}
6872

gix-features/Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ progress-unit-human-numbers = ["prodash?/unit-human"]
2525
progress-unit-bytes = ["dep:bytesize", "prodash?/unit-bytes"]
2626

2727
## If set, walkdir iterators will be multi-threaded.
28-
fs-walkdir-parallel = [ "dep:jwalk" ]
28+
fs-walkdir-parallel = [ "dep:jwalk", "dep:gix-utils" ]
29+
30+
## Provide utilities suitable for working with the `std::fs::read_dir()`.
31+
fs-read-dir = ["dep:gix-utils"]
2932

3033
## Implement `tracing` with `tracing-core`, which provides applications with valuable performance details if they opt-in to it.
3134
##
@@ -47,7 +50,7 @@ parallel = ["dep:crossbeam-channel",
4750
once_cell = ["dep:once_cell"]
4851
## Makes facilities of the `walkdir` crate partially available.
4952
## In conjunction with the **parallel** feature, directory walking will be parallel instead behind a compatible interface.
50-
walkdir = ["dep:walkdir"]
53+
walkdir = ["dep:walkdir", "dep:gix-utils"]
5154
#* an in-memory unidirectional pipe using `bytes` as efficient transfer mechanism.
5255
io-pipe = ["dep:bytes"]
5356
## provide a proven and fast `crc32` implementation.
@@ -117,6 +120,9 @@ required-features = ["io-pipe"]
117120
gix-hash = { version = "^0.14.1", path = "../gix-hash" }
118121
gix-trace = { version = "^0.1.7", path = "../gix-trace" }
119122

123+
# for walkdir
124+
gix-utils = { version = "^0.1.8", path = "../gix-utils", optional = true }
125+
120126
# 'parallel' feature
121127
crossbeam-channel = { version = "0.5.0", optional = true }
122128
parking_lot = { version = "0.12.0", default-features = false, optional = true }

0 commit comments

Comments
 (0)