Skip to content

Commit d6cd449

Browse files
committed
Merge branch 'various-fixes'
2 parents 3c21741 + e955770 commit d6cd449

File tree

109 files changed

+2186
-453
lines changed

Some content is hidden

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

109 files changed

+2186
-453
lines changed

Cargo.lock

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

Cargo.toml

+6-8
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ max = ["max-control", "fast", "gitoxide-core-blocking-client", "http-client-curl
4242
## transports as it uses Rust's HTTP implementation.
4343
##
4444
## As fast as possible, with TUI progress, progress line rendering with auto-configuration, all transports available but less mature pure Rust HTTP implementation, all `ein` tools, CLI colors and local-time support, JSON output, regex support for rev-specs.
45-
max-pure = ["max-control", "gix-features/rustsha1", "gix-features/zlib-rust-backend", "http-client-reqwest", "gitoxide-core-blocking-client" ]
45+
max-pure = ["max-control", "gix-features/rustsha1", "gix-features/zlib-rust-backend", "http-client-reqwest", "gitoxide-core-blocking-client"]
4646

4747
## Like `max`, but with more control for configuration. See the *Package Maintainers* headline for more information.
48-
max-control = ["tracing", "fast-safe", "pretty-cli", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-tools", "prodash-render-line", "prodash-render-tui", "prodash/render-line-autoconfigure", "gix/revparse-regex" ]
48+
max-control = ["tracing", "fast-safe", "pretty-cli", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-tools", "prodash-render-line", "prodash-render-tui", "prodash/render-line-autoconfigure", "gix/revparse-regex"]
4949

5050
## All of the good stuff, with less fanciness for smaller binaries.
5151
##
5252
## As fast as possible, progress line rendering, all transports based on their most mature implementation (HTTP), all `ein` tools, CLI colors and local-time support, JSON output.
53-
lean = ["fast", "tracing", "pretty-cli", "http-client-curl", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-tools", "gitoxide-core-blocking-client", "prodash-render-line" ]
53+
lean = ["fast", "tracing", "pretty-cli", "http-client-curl", "gitoxide-core-tools-query", "gitoxide-core-tools-corpus", "gitoxide-core-tools", "gitoxide-core-blocking-client", "prodash-render-line"]
5454

5555
## The smallest possible build, best suitable for small single-core machines.
5656
##
5757
## This build is essentially limited to local operations without any fanciness.
5858
##
5959
## Optimized for size, no parallelism thus much slower, progress line rendering.
60-
small = ["pretty-cli", "gix-features/rustsha1", "gix-features/zlib-rust-backend", "prodash-render-line", "is-terminal" ]
60+
small = ["pretty-cli", "gix-features/rustsha1", "gix-features/zlib-rust-backend", "prodash-render-line", "is-terminal"]
6161

6262
## Like lean, but uses Rusts async implementations for networking.
6363
##
@@ -107,12 +107,12 @@ fast = ["gix/max-performance", "gix/comfort"]
107107
fast-safe = ["gix/max-performance-safe", "gix/comfort"]
108108

109109
## Enable tracing in `gitoxide-core`.
110-
tracing = ["dep:tracing-forest", "dep:tracing-subscriber", "dep:tracing", "gix-features/tracing", "gix-features/tracing-detail" ]
110+
tracing = ["dep:tracing-forest", "dep:tracing-subscriber", "dep:tracing", "gix-features/tracing", "gix-features/tracing-detail"]
111111

112112
## Use `clap` 3.0 to build the prettiest, best documented and most user-friendly CLI at the expense of binary size.
113113
## Provides a terminal user interface for detailed and exhaustive progress.
114114
## Provides a line renderer for leaner progress display, without the need for a full-blown TUI.
115-
pretty-cli = [ "gitoxide-core/serde", "prodash/progress-tree", "prodash/progress-tree-log", "prodash/local-time", "env_logger/humantime", "env_logger/color", "env_logger/auto-color" ]
115+
pretty-cli = ["gitoxide-core/serde", "prodash/progress-tree", "prodash/progress-tree-log", "prodash/local-time", "env_logger/humantime", "env_logger/color", "env_logger/auto-color"]
116116

117117
## The `--verbose` flag will be powered by an interactive progress mechanism that doubles as log as well as interactive progress
118118
## that appears after a short duration.
@@ -285,9 +285,7 @@ members = [
285285
"gix-worktree-stream",
286286
"gix-revwalk",
287287
"gix-fsck",
288-
289288
"tests/tools",
290-
291289
"gix-diff/tests",
292290
"gix-pack/tests",
293291
"gix-odb/tests",

deny.toml

+1-23
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,6 @@
88
# More documentation for the advisories section can be found here:
99
# https://embarkstudios.github.io/cargo-deny/checks/advisories/cfg.html
1010
[advisories]
11-
# The path where the advisory database is cloned/fetched into
12-
db-path = "~/.cargo/advisory-db"
13-
# The url(s) of the advisory databases to use
14-
db-urls = ["https://github.com/rustsec/advisory-db"]
15-
# The lint level for security vulnerabilities
16-
vulnerability = "deny"
17-
# The lint level for unmaintained crates
18-
unmaintained = "warn"
19-
# The lint level for crates that have been yanked from their source registry
20-
yanked = "warn"
21-
# The lint level for crates with security notices. Note that as of
22-
# 2019-12-17 there are no security notice advisories in
23-
# https://github.com/rustsec/advisory-db
24-
notice = "warn"
2511
ignore = [
2612
# this is `[email protected]` coming in with `curl`, which doesn't have an update yet. It's only active optionally, not by default.
2713
"RUSTSEC-2024-0336",
@@ -33,28 +19,20 @@ ignore = [
3319
# More documentation for the licenses section can be found here:
3420
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
3521
[licenses]
36-
# The lint level for crates which do not have a detectable license
37-
unlicensed = "deny"
3822
# List of explicitly allowed licenses
3923
# See https://spdx.org/licenses/ for list of possible licenses
4024
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
4125
allow = [
4226
"Apache-2.0",
4327
"BSD-3-Clause",
28+
"BSL-1.0",
4429
"MIT",
4530
"MIT-0",
4631
"ISC",
4732
"Unicode-DFS-2016",
4833
"LicenseRef-ring",
4934
"Zlib"
5035
]
51-
# Lint level for licenses considered copyleft
52-
copyleft = "allow"
53-
# Lint level used when no other predicates are matched
54-
# 1. License isn't in the allow or deny lists
55-
# 2. License isn't copyleft
56-
# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither"
57-
default = "deny"
5836
# The confidence threshold for detecting a license from license text.
5937
# The higher the value, the more closely the license text must be to the
6038
# canonical license text of a valid SPDX license file.

gitoxide-core/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ estimate-hours = ["dep:fs-err", "dep:crossbeam-channel", "dep:smallvec"]
2323
query = ["dep:rusqlite"]
2424
## Run algorithms on a corpus of repositories and store their results for later comparison and intelligence gathering.
2525
## *Note that* `organize` we need for finding git repositories fast.
26-
corpus = [ "dep:rusqlite", "dep:sysinfo", "organize", "dep:crossbeam-channel", "dep:serde_json", "dep:tracing-forest", "dep:tracing-subscriber", "tracing", "dep:parking_lot" ]
26+
corpus = ["dep:rusqlite", "dep:sysinfo", "organize", "dep:crossbeam-channel", "dep:serde_json", "dep:tracing-forest", "dep:tracing-subscriber", "tracing", "dep:parking_lot"]
2727

2828
## The ability to create archives from virtual worktrees, similar to `git archive`.
2929
archive = ["dep:gix-archive-for-configuration-only", "gix/worktree-archive"]
@@ -77,7 +77,7 @@ crossbeam-channel = { version = "0.5.6", optional = true }
7777
smallvec = { version = "1.10.0", optional = true }
7878

7979
# for 'query' and 'corpus'
80-
rusqlite = { version = "0.30.0", optional = true, features = ["bundled"] }
80+
rusqlite = { version = "0.31.0", optional = true, features = ["bundled"] }
8181

8282
# for 'corpus'
8383
parking_lot = { version = "0.12.1", optional = true }

gitoxide-core/src/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,11 @@ pub use discover::discover;
8484

8585
#[cfg(all(feature = "async-client", feature = "blocking-client"))]
8686
compile_error!("Cannot set both 'blocking-client' and 'async-client' features as they are mutually exclusive");
87+
88+
fn is_dir_to_mode(is_dir: bool) -> gix::index::entry::Mode {
89+
if is_dir {
90+
gix::index::entry::Mode::DIR
91+
} else {
92+
gix::index::entry::Mode::FILE
93+
}
94+
}

gitoxide-core/src/repository/attributes/query.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub(crate) mod function {
1414
use gix::bstr::BStr;
1515

1616
use crate::{
17+
is_dir_to_mode,
1718
repository::{
1819
attributes::query::{attributes_cache, Options},
1920
PathsOrPatterns,
@@ -38,12 +39,12 @@ pub(crate) mod function {
3839
match input {
3940
PathsOrPatterns::Paths(paths) => {
4041
for path in paths {
41-
let is_dir = gix::path::from_bstr(Cow::Borrowed(path.as_ref()))
42+
let mode = gix::path::from_bstr(Cow::Borrowed(path.as_ref()))
4243
.metadata()
4344
.ok()
44-
.map(|m| m.is_dir());
45+
.map(|m| is_dir_to_mode(m.is_dir()));
4546

46-
let entry = cache.at_entry(path.as_slice(), is_dir)?;
47+
let entry = cache.at_entry(path.as_slice(), mode)?;
4748
if !entry.matching_attributes(&mut matches) {
4849
continue;
4950
}
@@ -61,9 +62,9 @@ pub(crate) mod function {
6162
)?;
6263
let mut pathspec_matched_entry = false;
6364
if let Some(it) = pathspec.index_entries_with_paths(&index) {
64-
for (path, _entry) in it {
65+
for (path, entry) in it {
6566
pathspec_matched_entry = true;
66-
let entry = cache.at_entry(path, Some(false))?;
67+
let entry = cache.at_entry(path, entry.mode.into())?;
6768
if !entry.matching_attributes(&mut matches) {
6869
continue;
6970
}
@@ -87,10 +88,10 @@ pub(crate) mod function {
8788
let path = pattern.path();
8889
let entry = cache.at_entry(
8990
path,
90-
Some(
91+
Some(is_dir_to_mode(
9192
workdir.map_or(false, |wd| wd.join(gix::path::from_bstr(path)).is_dir())
9293
|| pattern.signature.contains(gix::pathspec::MagicSignature::MUST_BE_DIR),
93-
),
94+
)),
9495
)?;
9596
if !entry.matching_attributes(&mut matches) {
9697
continue;

gitoxide-core/src/repository/attributes/validate_baseline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub(crate) mod function {
192192
);
193193

194194
for (rela_path, baseline) in rx_base {
195-
let entry = cache.at_entry(rela_path.as_str(), Some(false))?;
195+
let entry = cache.at_entry(rela_path.as_str(), None)?;
196196
match baseline {
197197
Baseline::Attribute { assignments: expected } => {
198198
entry.matching_attributes(&mut matches);

gitoxide-core/src/repository/exclude.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{borrow::Cow, io};
33
use anyhow::bail;
44
use gix::bstr::BStr;
55

6-
use crate::{repository::PathsOrPatterns, OutputFormat};
6+
use crate::{is_dir_to_mode, repository::PathsOrPatterns, OutputFormat};
77

88
pub mod query {
99
use std::ffi::OsString;
@@ -44,11 +44,11 @@ pub fn query(
4444
match input {
4545
PathsOrPatterns::Paths(paths) => {
4646
for path in paths {
47-
let is_dir = gix::path::from_bstr(Cow::Borrowed(path.as_ref()))
47+
let mode = gix::path::from_bstr(Cow::Borrowed(path.as_ref()))
4848
.metadata()
4949
.ok()
50-
.map(|m| m.is_dir());
51-
let entry = cache.at_entry(path.as_slice(), is_dir)?;
50+
.map(|m| is_dir_to_mode(m.is_dir()));
51+
let entry = cache.at_entry(path.as_slice(), mode)?;
5252
let match_ = entry
5353
.matching_exclude_pattern()
5454
.and_then(|m| (show_ignore_patterns || !m.pattern.is_negative()).then_some(m));
@@ -66,9 +66,9 @@ pub fn query(
6666
)?;
6767

6868
if let Some(it) = pathspec.index_entries_with_paths(&index) {
69-
for (path, _entry) in it {
69+
for (path, entry) in it {
7070
pathspec_matched_something = true;
71-
let entry = cache.at_entry(path, Some(false))?;
71+
let entry = cache.at_entry(path, entry.mode.into())?;
7272
let match_ = entry
7373
.matching_exclude_pattern()
7474
.and_then(|m| (show_ignore_patterns || !m.pattern.is_negative()).then_some(m));
@@ -92,10 +92,10 @@ pub fn query(
9292
let path = pattern.path();
9393
let entry = cache.at_entry(
9494
path,
95-
Some(
95+
Some(is_dir_to_mode(
9696
workdir.map_or(false, |wd| wd.join(gix::path::from_bstr(path)).is_dir())
9797
|| pattern.signature.contains(gix::pathspec::MagicSignature::MUST_BE_DIR),
98-
),
98+
)),
9999
)?;
100100
let match_ = entry
101101
.matching_exclude_pattern()

gitoxide-core/src/repository/index/entries.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub(crate) mod function {
3131
};
3232

3333
use crate::{
34+
is_dir_to_mode,
3435
repository::index::entries::{Attributes, Options},
3536
OutputFormat,
3637
};
@@ -174,7 +175,7 @@ pub(crate) mod function {
174175
}
175176
// The user doesn't want attributes, so we set the cache position on demand only
176177
None => cache
177-
.at_entry(rela_path, Some(is_dir))
178+
.at_entry(rela_path, Some(is_dir_to_mode(is_dir)))
178179
.ok()
179180
.map(|platform| platform.matching_attributes(out))
180181
.unwrap_or_default(),

gitoxide-core/src/repository/revision/resolve.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,10 @@ pub(crate) mod function {
127127
}
128128
gix::object::Kind::Blob if cache.is_some() && spec.path_and_mode().is_some() => {
129129
let (path, mode) = spec.path_and_mode().expect("is present");
130-
let is_dir = Some(mode.is_tree());
131130
match cache.expect("is some") {
132131
(BlobFormat::Git, _) => unreachable!("no need for a cache when querying object db"),
133132
(BlobFormat::Worktree, cache) => {
134-
let platform = cache.attr_stack.at_entry(path, is_dir, &repo.objects)?;
133+
let platform = cache.attr_stack.at_entry(path, Some(mode.into()), &repo.objects)?;
135134
let object = id.object()?;
136135
let mut converted = cache.filter.worktree_filter.convert_to_worktree(
137136
&object.data,

gix-archive/Cargo.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ gix-path = { version = "^0.10.7", path = "../gix-path", optional = true }
3131
gix-date = { version = "^0.8.6", path = "../gix-date" }
3232

3333
flate2 = { version = "1.0.26", optional = true }
34-
zip = { version = "0.6.6", optional = true, default-features = false, features = ["deflate", "time"] }
34+
zip = { version = "1.3.1", optional = true, default-features = false, features = ["deflate", "time"] }
3535
time = { version = "0.3.23", optional = true, default-features = false, features = ["std"] }
3636

3737
thiserror = "1.0.26"
@@ -42,13 +42,13 @@ tar = { version = "0.4.38", optional = true }
4242
document-features = { version = "0.2.0", optional = true }
4343

4444
[dev-dependencies]
45-
gix-testtools = { path = "../tests/tools"}
46-
gix-odb = { path = "../gix-odb"}
47-
gix-worktree = { path = "../gix-worktree", default-features = false, features = ["attributes"]}
48-
gix-hash = { path = "../gix-hash"}
49-
gix-attributes = { path = "../gix-attributes"}
50-
gix-object = { path = "../gix-object"}
51-
gix-filter = { path = "../gix-filter"}
45+
gix-testtools = { path = "../tests/tools" }
46+
gix-odb = { path = "../gix-odb" }
47+
gix-worktree = { path = "../gix-worktree", default-features = false, features = ["attributes"] }
48+
gix-hash = { path = "../gix-hash" }
49+
gix-attributes = { path = "../gix-attributes" }
50+
gix-object = { path = "../gix-object" }
51+
gix-filter = { path = "../gix-filter" }
5252

5353
[package.metadata.docs.rs]
5454
all-features = true

gix-archive/src/write.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ where
126126
NextFn: FnMut(&mut Stream) -> Result<Option<Entry<'_>>, gix_worktree_stream::entry::Error>,
127127
{
128128
let compression_level = match opts.format {
129-
Format::Zip { compression_level } => compression_level.map(|lvl| lvl as i32),
129+
Format::Zip { compression_level } => compression_level.map(|lvl| lvl as i64),
130130
_other => return write_stream(stream, next_entry, out, opts),
131131
};
132132

@@ -161,10 +161,10 @@ fn append_zip_entry<W: std::io::Write + std::io::Seek>(
161161
mut entry: gix_worktree_stream::Entry<'_>,
162162
buf: &mut Vec<u8>,
163163
mtime: zip::DateTime,
164-
compression_level: Option<i32>,
164+
compression_level: Option<i64>,
165165
tree_prefix: Option<&bstr::BString>,
166166
) -> Result<(), Error> {
167-
let file_opts = zip::write::FileOptions::default()
167+
let file_opts = zip::write::FileOptions::<'_, ()>::default()
168168
.compression_method(zip::CompressionMethod::Deflated)
169169
.compression_level(compression_level)
170170
.large_file(entry.bytes_remaining().map_or(true, |len| len > u32::MAX as usize))

gix-archive/tests/archive.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ mod from_tree {
208208
);
209209
let mut link = ar.by_name("prefix/symlink-to-a")?;
210210
assert!(!link.is_dir());
211-
assert!(link.is_file(), "no symlink differentiation");
211+
assert_eq!(
212+
link.is_symlink(),
213+
cfg!(not(windows)),
214+
"symlinks are supported as well, but only on Unix"
215+
);
212216
assert_eq!(
213217
link.unix_mode(),
214218
Some(if cfg!(windows) { 0o100644 } else { 0o120644 }),
@@ -233,7 +237,7 @@ mod from_tree {
233237
noop_pipeline(),
234238
move |rela_path, mode, attrs| {
235239
cache
236-
.at_entry(rela_path, mode.is_tree().into(), &odb)
240+
.at_entry(rela_path, Some(mode.into()), &odb)
237241
.map(|entry| entry.matching_attributes(attrs))
238242
.map(|_| ())
239243
},

gix-config/tests/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ name = "mem"
1919
path = "mem.rs"
2020

2121
[dev-dependencies]
22-
gix-config = { path = ".."}
23-
gix-testtools = { path = "../../tests/tools"}
22+
gix-config = { path = ".." }
23+
gix-testtools = { path = "../../tests/tools" }
2424
gix = { path = "../../gix", default-features = false }
2525
gix-ref = { path = "../../gix-ref" }
2626
gix-path = { path = "../../gix-path" }
2727
gix-sec = { path = "../../gix-sec" }
28-
serial_test = { version = "2.0.0", default-features = false }
28+
serial_test = { version = "3.1.0", default-features = false }
2929
bstr = { version = "1.3.0", default-features = false, features = ["std"] }
3030

3131
bytesize = "1.3.0"

gix-diff/src/blob/platform.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -583,14 +583,14 @@ impl Platform {
583583
if self.diff_cache.contains_key(storage) {
584584
return Ok(());
585585
}
586-
let entry = self
587-
.attr_stack
588-
.at_entry(rela_path, Some(false), objects)
589-
.map_err(|err| set_resource::Error::Attributes {
590-
source: err,
591-
kind,
592-
rela_path: rela_path.to_owned(),
593-
})?;
586+
let entry =
587+
self.attr_stack
588+
.at_entry(rela_path, None, objects)
589+
.map_err(|err| set_resource::Error::Attributes {
590+
source: err,
591+
kind,
592+
rela_path: rela_path.to_owned(),
593+
})?;
594594
let mut buf = Vec::new();
595595
let out = self.filter.convert_to_diffable(
596596
&id,

0 commit comments

Comments
 (0)