Lukas Wirth
cedab5d9fd
Add test for cargo rustc --print cfg
that relies on an env target
2025-01-07 18:57:03 +01:00
Rustin
9438fe303a
Avoid naming variables str
( #15025 )
...
This renames variables named `str` to other names, to make sure `str`
always refers to a type.
2025-01-07 14:11:18 +00:00
Josh Triplett
1fe4591da3
Avoid naming variables str
...
This renames variables named `str` to other names, to make sure `str`
always refers to a type.
2025-01-07 13:50:15 +02:00
Ed Page
c1febbe121
Bump to 0.87.0; update changelog ( #15022 )
...
[rendered](https://github.com/weihanglo/cargo/blob/version-bump/CHANGELOG.md )
2025-01-07 01:27:29 +00:00
Weihang Lo
6ee4968d2a
docs: update changelog for 1.86.0
2025-01-06 19:54:35 -05:00
Weihang Lo
63f1325fcb
docs: update changelog for 1.85.0
2025-01-06 19:54:35 -05:00
Weihang Lo
637c41e987
chore: bump to 0.87.0
2025-01-06 14:35:04 -05:00
Weihang Lo
12541d6e5e
Update libgit2 to 1.9 ( #15018 )
...
This is a routine update of libgit2 to 1.9.
libgit2 1.9 release notes:
https://github.com/libgit2/libgit2/releases/tag/v1.9.0
git2:
https://github.com/rust-lang/git2-rs/blob/master/CHANGELOG.md#0200---2025-01-04
2025-01-05 02:59:36 +00:00
Eric Huss
f96b7298a7
Update git2
2025-01-04 16:55:32 -08:00
Weihang Lo
0f9e730043
Remove condition on RUSTUP_WINDOWS_PATH_ADD_BIN ( #15017 )
...
This is no longer needed since rustup 1.27.1 which changed the default
to false.
### How should we test and review this PR?
On windows, run `cargo test --test testsuite -- global_cache_tracker`
2025-01-04 20:18:39 +00:00
Weihang Lo
d10e9cdf65
Fix https::self_signed_should_fail for macos ( #15016 )
...
This no longer generates the same error message for the same reason that
it changed for linux in https://github.com/rust-lang/cargo/pull/13970 .
Note that Windows does things slightly differently, and doesn't need
adjustment.
2025-01-04 19:50:59 +00:00
Eric Huss
e6ecef6cc8
Remove condition on RUSTUP_WINDOWS_PATH_ADD_BIN
...
This is no longer needed since rustup 1.27.1 which changed the default
to false.
2025-01-04 11:49:20 -08:00
Eric Huss
506f409a2e
Fix https::self_signed_should_fail for macos
...
This no longer generates the same error message for the same reason that
it changed for linux in https://github.com/rust-lang/cargo/pull/13970 .
Note that Windows does things slightly differently, and doesn't need
adjustment.
2025-01-04 11:19:35 -08:00
Kornel
973cd5338e
Update autogenerated files
2025-01-04 14:37:39 +00:00
Urgau
208f817c83
Add preparatory tests for lib.test = false
check-cfg changes
2025-01-04 13:42:59 +01:00
Kornel
22690a3236
Make --allow-dirty imply --allow-staged
2025-01-04 00:25:41 +00:00
Ed Page
fd784878cf
chore: bump gix-lock to remove thiserror@1 from cargo
( #15012 )
...
### What does this PR try to resolve?
A follow-up of #14998
Other dev tools for cargo development are fine keeping v1. They are not
shipped to end users.
Before
```
$ cargo tree --workspace -i thiserror@1.0.63
thiserror v1.0.63
├── cargo_metadata v0.19.0
│ └── capture v0.1.0 (/projects/cargo/benches/capture)
├── gix-lock v15.0.0
│ ├── gix v0.69.1
│ │ └── cargo v0.86.0 (/projects/cargo)
│ │ ├── benchsuite v0.0.0 (/projects/cargo/benches/benchsuite)
│ │ ├── resolver-tests v0.0.0 (/projects/cargo/crates/resolver-tests)
│ │ ├── xtask-bump-check v0.0.0 (/projects/cargo/crates/xtask-bump-check)
│ │ └── xtask-lint-docs v0.1.0 (/projects/cargo/crates/xtask-lint-docs)
│ │ [dev-dependencies]
│ │ └── cargo v0.86.0 (/projects/cargo) (*)
│ ├── gix-index v0.37.0
│ │ ├── gix v0.69.1 (*)
│ │ ├── gix-dir v0.11.0
│ │ │ └── gix v0.69.1 (*)
│ │ └── gix-worktree v0.38.0
│ │ ├── gix v0.69.1 (*)
│ │ └── gix-dir v0.11.0 (*)
│ ├── gix-protocol v0.47.0
│ │ └── gix v0.69.1 (*)
│ ├── gix-ref v0.49.1
│ │ ├── gix v0.69.1 (*)
│ │ ├── gix-config v0.42.0
│ │ │ ├── gix v0.69.1 (*)
│ │ │ └── gix-submodule v0.16.0
│ │ │ └── gix v0.69.1 (*)
│ │ ├── gix-discover v0.37.0
│ │ │ ├── gix v0.69.1 (*)
│ │ │ └── gix-dir v0.11.0 (*)
│ │ └── gix-protocol v0.47.0 (*)
│ └── gix-shallow v0.1.0
│ ├── gix v0.69.1 (*)
│ └── gix-protocol v0.47.0 (*)
├── handlebars v6.2.0
│ └── mdman v0.0.0 (/projects/cargo/crates/mdman)
├── pest v2.7.9
│ ├── handlebars v6.2.0 (*)
│ ├── pest_derive v2.7.9 (proc-macro)
│ │ └── handlebars v6.2.0 (*)
│ ├── pest_generator v2.7.9
│ │ └── pest_derive v2.7.9 (proc-macro) (*)
│ └── pest_meta v2.7.9
│ └── pest_generator v2.7.9 (*)
├── varisat v0.2.2
│ └── resolver-tests v0.0.0 (/projects/cargo/crates/resolver-tests)
├── varisat-checker v0.2.2
│ └── varisat v0.2.2 (*)
└── varisat-dimacs v0.2.2
├── varisat v0.2.2 (*)
└── varisat-checker v0.2.2 (*)
```
After
```
$ cargo tree --workspace -i thiserror@1.0.63
thiserror v1.0.63
├── cargo_metadata v0.19.0
│ └── capture v0.1.0 (/projects/cargo/benches/capture)
├── handlebars v6.2.0
│ └── mdman v0.0.0 (/projects/cargo/crates/mdman)
├── pest v2.7.9
│ ├── handlebars v6.2.0 (*)
│ ├── pest_derive v2.7.9 (proc-macro)
│ │ └── handlebars v6.2.0 (*)
│ ├── pest_generator v2.7.9
│ │ └── pest_derive v2.7.9 (proc-macro) (*)
│ └── pest_meta v2.7.9
│ └── pest_generator v2.7.9 (*)
├── varisat v0.2.2
│ └── resolver-tests v0.0.0 (/projects/cargo/crates/resolver-tests)
├── varisat-checker v0.2.2
│ └── varisat v0.2.2 (*)
└── varisat-dimacs v0.2.2
├── varisat v0.2.2 (*)
└── varisat-checker v0.2.2 (*)
```
### How should we test and review this PR?
It has nothing changed but thiserror version.
https://diff.rs/gix-lock/15.0.0/gix-lock/15.0.1/Cargo.toml/
2025-01-03 20:06:26 +00:00
Weihang Lo
3e9b28a0d6
chore: bump gix-lock to remove thiserror@1 from cargo
...
Other dev tools for cargo development are fine keeping v1.
They are not shipped to end users.
Before
```
cargo tree --workspace -i thiserror@1.0.63
thiserror v1.0.63
├── cargo_metadata v0.19.0
│ └── capture v0.1.0 (/projects/cargo/benches/capture)
├── gix-lock v15.0.0
│ ├── gix v0.69.1
│ │ └── cargo v0.86.0 (/projects/cargo)
│ │ ├── benchsuite v0.0.0 (/projects/cargo/benches/benchsuite)
│ │ ├── resolver-tests v0.0.0 (/projects/cargo/crates/resolver-tests)
│ │ ├── xtask-bump-check v0.0.0 (/projects/cargo/crates/xtask-bump-check)
│ │ └── xtask-lint-docs v0.1.0 (/projects/cargo/crates/xtask-lint-docs)
│ │ [dev-dependencies]
│ │ └── cargo v0.86.0 (/projects/cargo) (*)
│ ├── gix-index v0.37.0
│ │ ├── gix v0.69.1 (*)
│ │ ├── gix-dir v0.11.0
│ │ │ └── gix v0.69.1 (*)
│ │ └── gix-worktree v0.38.0
│ │ ├── gix v0.69.1 (*)
│ │ └── gix-dir v0.11.0 (*)
│ ├── gix-protocol v0.47.0
│ │ └── gix v0.69.1 (*)
│ ├── gix-ref v0.49.1
│ │ ├── gix v0.69.1 (*)
│ │ ├── gix-config v0.42.0
│ │ │ ├── gix v0.69.1 (*)
│ │ │ └── gix-submodule v0.16.0
│ │ │ └── gix v0.69.1 (*)
│ │ ├── gix-discover v0.37.0
│ │ │ ├── gix v0.69.1 (*)
│ │ │ └── gix-dir v0.11.0 (*)
│ │ └── gix-protocol v0.47.0 (*)
│ └── gix-shallow v0.1.0
│ ├── gix v0.69.1 (*)
│ └── gix-protocol v0.47.0 (*)
├── handlebars v6.2.0
│ └── mdman v0.0.0 (/projects/cargo/crates/mdman)
├── pest v2.7.9
│ ├── handlebars v6.2.0 (*)
│ ├── pest_derive v2.7.9 (proc-macro)
│ │ └── handlebars v6.2.0 (*)
│ ├── pest_generator v2.7.9
│ │ └── pest_derive v2.7.9 (proc-macro) (*)
│ └── pest_meta v2.7.9
│ └── pest_generator v2.7.9 (*)
├── varisat v0.2.2
│ └── resolver-tests v0.0.0 (/projects/cargo/crates/resolver-tests)
├── varisat-checker v0.2.2
│ └── varisat v0.2.2 (*)
└── varisat-dimacs v0.2.2
├── varisat v0.2.2 (*)
└── varisat-checker v0.2.2 (*)
```
After
```
cargo tree --workspace -i thiserror@1.0.63
thiserror v1.0.63
├── cargo_metadata v0.19.0
│ └── capture v0.1.0 (/projects/cargo/benches/capture)
├── handlebars v6.2.0
│ └── mdman v0.0.0 (/projects/cargo/crates/mdman)
├── pest v2.7.9
│ ├── handlebars v6.2.0 (*)
│ ├── pest_derive v2.7.9 (proc-macro)
│ │ └── handlebars v6.2.0 (*)
│ ├── pest_generator v2.7.9
│ │ └── pest_derive v2.7.9 (proc-macro) (*)
│ └── pest_meta v2.7.9
│ └── pest_generator v2.7.9 (*)
├── varisat v0.2.2
│ └── resolver-tests v0.0.0 (/projects/cargo/crates/resolver-tests)
├── varisat-checker v0.2.2
│ └── varisat v0.2.2 (*)
└── varisat-dimacs v0.2.2
├── varisat v0.2.2 (*)
└── varisat-checker v0.2.2 (*)
```
2025-01-03 14:30:08 -05:00
Weihang Lo
2939e969f5
refactor(manifest): Clean up field -> env var handling ( #15008 )
...
### What does this PR try to resolve?
This is basically my PR feedback for #14973 .
### How should we test and review this PR?
### Additional information
2025-01-02 22:20:42 +00:00
Ed Page
0414bb5ac1
refactor(manifest): Keep struct/impl close for easier viewing
2025-01-02 15:06:17 -06:00
Ed Page
711d6bef36
refactor(manifest): Make env macro as minimal as possible
...
Macros add a lot of code complexity. This tries to reduce it by making
the macro do the bare minimum possible.
This does cause some extra branching (unless its compiled out) but that
shouldn't be prohibitive.
2025-01-02 15:03:11 -06:00
Ed Page
b16514de3b
refactor(manifest): Fully qualify manifest env vars
...
This simplifies the macro and makes the content searchable
2025-01-02 14:52:57 -06:00
Ed Page
f30f452e3c
chore(deps): update rust crate thiserror to v2 ( #14998 )
...
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [thiserror](https://redirect.github.com/dtolnay/thiserror ) |
workspace.dependencies | major | `1.0.63` -> `2.0.0` |
---
### Release Notes
<details>
<summary>dtolnay/thiserror (thiserror)</summary>
###
[`v2.0.9`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.9 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.8...2.0.9 )
- Work around `missing_inline_in_public_items` clippy restriction being
triggered in macro-generated code
([#​404](https://redirect.github.com/dtolnay/thiserror/issues/404 ))
###
[`v2.0.8`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.8 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.7...2.0.8 )
- Improve support for macro-generated `derive(Error)` call sites
([#​399](https://redirect.github.com/dtolnay/thiserror/issues/399 ))
###
[`v2.0.7`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.7 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.6...2.0.7 )
- Work around conflict with #\[deny(clippy::allow_attributes)]
([#​397](https://redirect.github.com/dtolnay/thiserror/issues/397 ),
thanks [@​zertosh](https://redirect.github.com/zertosh ))
###
[`v2.0.6`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.6 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.5...2.0.6 )
- Suppress deprecation warning on generated From impls
([#​396](https://redirect.github.com/dtolnay/thiserror/issues/396 ))
###
[`v2.0.5`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.5 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.4...2.0.5 )
- Prevent deprecation warning on generated impl for deprecated type
([#​394](https://redirect.github.com/dtolnay/thiserror/issues/394 ))
###
[`v2.0.4`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.4 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.3...2.0.4 )
- Eliminate needless_lifetimes clippy lint in generated `From` impls
([#​391](https://redirect.github.com/dtolnay/thiserror/issues/391 ),
thanks [@​matt-phylum](https://redirect.github.com/matt-phylum ))
###
[`v2.0.3`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.3 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.2...2.0.3 )
- Support the same Path field being repeated in both Debug and Display
representation in error message
([#​383](https://redirect.github.com/dtolnay/thiserror/issues/383 ))
- Improve error message when a format trait used in error message is not
implemented by some field
([#​384](https://redirect.github.com/dtolnay/thiserror/issues/384 ))
###
[`v2.0.2`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.2 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.1...2.0.2 )
- Fix hang on invalid input inside #\[error(...)] attribute
([#​382](https://redirect.github.com/dtolnay/thiserror/issues/382 ))
###
[`v2.0.1`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.1 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/2.0.0...2.0.1 )
- Support errors that contain a dynamically sized final field
([#​375](https://redirect.github.com/dtolnay/thiserror/issues/375 ))
- Improve inference of trait bounds for fields that are interpolated
multiple times in an error message
([#​377](https://redirect.github.com/dtolnay/thiserror/issues/377 ))
###
[`v2.0.0`](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.0 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/1.0.69...2.0.0 )
#### Breaking changes
- Referencing keyword-named fields by a raw identifier like `{r#type}`
inside a format string is no longer accepted; simply use the unraw name
like `{type}`
([#​347](https://redirect.github.com/dtolnay/thiserror/issues/347 ))
This aligns thiserror with the standard library's formatting macros,
which gained support for implicit argument capture later than the
release of this feature in thiserror 1.x.
```rust
#[derive(Error, Debug)]
#[error("... {type} ...")] // Before: {r#type}
pub struct Error {
pub r#type: Type,
}
```
- Trait bounds are no longer inferred on fields whose value is shadowed
by an explicit named argument in a format message
([#​345](https://redirect.github.com/dtolnay/thiserror/issues/345 ))
```rust
// Before: impl<T: Octal> Display for Error<T>
// After: impl<T> Display for Error<T>
#[derive(Error, Debug)]
#[error("{thing:o}", thing = "...")]
pub struct Error<T> {
thing: T,
}
```
- Tuple structs and tuple variants can no longer use numerical `{0}`
`{1}` access at the same time as supplying extra positional arguments
for a format message, as this makes it ambiguous whether the number
refers to a tuple field vs a different positional arg
([#​354](https://redirect.github.com/dtolnay/thiserror/issues/354 ))
```rust
#[derive(Error, Debug)]
#[error("ambiguous: {0} {}", $N)]
// ^^^ Not allowed, use #[error("... {0} {n}", n = $N)]
pub struct TupleError(i32);
```
- Code containing invocations of thiserror's `derive(Error)` must now
have a direct dependency on the `thiserror` crate regardless of the
error data structure's contents
([#​368](https://redirect.github.com/dtolnay/thiserror/issues/368 ),
[#​369](https://redirect.github.com/dtolnay/thiserror/issues/369 ),
[#​370](https://redirect.github.com/dtolnay/thiserror/issues/370 ),
[#​372](https://redirect.github.com/dtolnay/thiserror/issues/372 ))
#### Features
- Support disabling thiserror's standard library dependency by disabling
the default "std" Cargo feature: `thiserror = { version = "2",
default-features = false }`
([#​373](https://redirect.github.com/dtolnay/thiserror/issues/373 ))
- Support using `r#source` as field name to opt out of a field named
"source" being treated as an error's `Error::source()`
([#​350](https://redirect.github.com/dtolnay/thiserror/issues/350 ))
```rust
#[derive(Error, Debug)]
#[error("{source} ==> {destination}")]
pub struct Error {
r#source: char,
destination: char,
}
let error = Error { source: 'S', destination: 'D' };
```
- Infinite recursion in a generated Display impl now produces an
`unconditional_recursion` warning
([#​359](https://redirect.github.com/dtolnay/thiserror/issues/359 ))
```rust
#[derive(Error, Debug)]
#[error("??? {self}")]
pub struct Error;
```
- A new attribute `#[error(fmt = path::to::myfmt)]` can be used to write
formatting logic for an enum variant out-of-line
([#​367](https://redirect.github.com/dtolnay/thiserror/issues/367 ))
```rust
#[derive(Error, Debug)]
pub enum Error {
#[error(fmt = demo_fmt)]
Demo { code: u16, message: Option<String> },
}
fn demo_fmt(code: &u16, message: &Option<String>, formatter: &mut
fmt::Formatter) -> fmt::Result {
write!(formatter, "{code}")?;
if let Some(msg) = message {
write!(formatter, " - {msg}")?;
}
Ok(())
}
```
- Enums with an enum-level format message are now able to have
individual variants that are `transparent` to supersede the enum-level
message
([#​366](https://redirect.github.com/dtolnay/thiserror/issues/366 ))
```rust
#[derive(Error, Debug)]
#[error("my error {0}")]
pub enum Error {
Json(#[from] serde_json::Error),
Yaml(#[from] serde_yaml::Error),
#[error(transparent)]
Other(#[from] anyhow::Error),
}
```
###
[`v1.0.69`](https://redirect.github.com/dtolnay/thiserror/releases/tag/1.0.69 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/1.0.68...1.0.69 )
- Backport
[2.0.2](https://redirect.github.com/dtolnay/thiserror/releases/tag/2.0.2 )
fixes
###
[`v1.0.68`](https://redirect.github.com/dtolnay/thiserror/releases/tag/1.0.68 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/1.0.67...1.0.68 )
- Handle incomplete expressions more robustly in format arguments, such
as while code is being typed
([#​341](https://redirect.github.com/dtolnay/thiserror/issues/341 ),
[#​344](https://redirect.github.com/dtolnay/thiserror/issues/344 ))
###
[`v1.0.67`](https://redirect.github.com/dtolnay/thiserror/releases/tag/1.0.67 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/1.0.66...1.0.67 )
- Improve expression syntax support inside format arguments
([#​335](https://redirect.github.com/dtolnay/thiserror/issues/335 ),
[#​337](https://redirect.github.com/dtolnay/thiserror/issues/337 ),
[#​339](https://redirect.github.com/dtolnay/thiserror/issues/339 ),
[#​340](https://redirect.github.com/dtolnay/thiserror/issues/340 ))
###
[`v1.0.66`](https://redirect.github.com/dtolnay/thiserror/releases/tag/1.0.66 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/1.0.65...1.0.66 )
- Improve compile error on malformed format attribute
([#​327](https://redirect.github.com/dtolnay/thiserror/issues/327 ))
###
[`v1.0.65`](https://redirect.github.com/dtolnay/thiserror/releases/tag/1.0.65 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/1.0.64...1.0.65 )
- Ensure OUT_DIR is left with deterministic contents after build script
execution
([#​325](https://redirect.github.com/dtolnay/thiserror/issues/325 ))
###
[`v1.0.64`](https://redirect.github.com/dtolnay/thiserror/releases/tag/1.0.64 )
[Compare
Source](https://redirect.github.com/dtolnay/thiserror/compare/1.0.63...1.0.64 )
- Exclude derived impls from coverage instrumentation
([#​322](https://redirect.github.com/dtolnay/thiserror/issues/322 ),
thanks [@​oxalica](https://redirect.github.com/oxalica ))
</details>
---
### Configuration
📅 **Schedule**: Branch creation - "before 5am on the first day of the
month" (UTC), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/rust-lang/cargo ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS44NS4wIiwidXBkYXRlZEluVmVyIjoiMzkuODUuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->
2025-01-02 19:58:01 +00:00
renovate[bot]
13af53a518
chore(deps): update rust crate thiserror to v2
2025-01-02 13:18:39 -06:00
Rustin170506
0c2bb4e5a8
test: add the dep case
...
Signed-off-by: Rustin170506 <techregister@pm.me>
2025-01-02 23:17:15 +08:00
Rustin170506
feda97d9f2
test: add the no lock file case
...
Signed-off-by: Rustin170506 <techregister@pm.me>
2025-01-02 23:17:15 +08:00
Rustin170506
5465e6a451
fix: remove unsupported embedded workspace check from cargo pkgid
command
...
Signed-off-by: Rustin170506 <techregister@pm.me>
2025-01-02 23:17:11 +08:00
Weihang Lo
fbca21b87b
test(git): Clean up shallow fetch tests ( #15002 )
...
### What does this PR try to resolve?
When looking to add shallow fetch for the git CLI, I found it hard to
tell what we test. This tries to clean up the tests and make it easier
to add new ones. My hope is to later generalize the test bodies so we
can more easily test any git backend in any combination of shallow or
deep fetches.
This is part of #13285 .
### How should we test and review this PR?
### Additional information
2025-01-02 04:15:36 +00:00
Ed Page
0200aa0d63
fix(schema): Correct and update the JSON Schema ( #15000 )
...
### What does this PR try to resolve?
Fixes #14999
### How should we test and review this PR?
### Additional information
2025-01-01 17:59:14 +00:00
Weihang Lo
f73259dbff
chore(deps): update rust crate itertools to 0.14.0 ( #14996 )
...
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [itertools](https://redirect.github.com/rust-itertools/itertools ) |
workspace.dependencies | minor | `0.13.0` -> `0.14.0` |
---
### Release Notes
<details>
<summary>rust-itertools/itertools (itertools)</summary>
###
[`v0.14.0`](https://redirect.github.com/rust-itertools/itertools/blob/HEAD/CHANGELOG.md#0140 )
[Compare
Source](https://redirect.github.com/rust-itertools/itertools/compare/v0.13.0...v0.14.0 )
##### Breaking
- Increased MSRV to 1.63.0
([#​960](https://redirect.github.com/rust-itertools/itertools/issues/960 ))
- Removed generic parameter from `cons_tuples`
([#​988](https://redirect.github.com/rust-itertools/itertools/issues/988 ))
##### Added
- Added `array_combinations`
([#​991](https://redirect.github.com/rust-itertools/itertools/issues/991 ))
- Added `k_smallest_relaxed` and variants
([#​925](https://redirect.github.com/rust-itertools/itertools/issues/925 ))
- Added `next_array` and `collect_array`
([#​560](https://redirect.github.com/rust-itertools/itertools/issues/560 ))
- Implemented `DoubleEndedIterator` for `FilterOk`
([#​948](https://redirect.github.com/rust-itertools/itertools/issues/948 ))
- Implemented `DoubleEndedIterator` for `FilterMapOk`
([#​950](https://redirect.github.com/rust-itertools/itertools/issues/950 ))
##### Changed
- Allow `Q: ?Sized` in `Itertools::contains`
([#​971](https://redirect.github.com/rust-itertools/itertools/issues/971 ))
- Improved hygiene of `chain!`
([#​943](https://redirect.github.com/rust-itertools/itertools/issues/943 ))
- Improved `into_group_map_by` documentation
([#​1000](https://redirect.github.com/rust-itertools/itertools/issues/1000 ))
- Improved `tree_reduce` documentation
([#​955](https://redirect.github.com/rust-itertools/itertools/issues/955 ))
- Improved discoverability of `merge_join_by`
([#​966](https://redirect.github.com/rust-itertools/itertools/issues/966 ))
- Improved discoverability of `take_while_inclusive`
([#​972](https://redirect.github.com/rust-itertools/itertools/issues/972 ))
- Improved documentation of `find_or_last` and `find_or_first`
([#​984](https://redirect.github.com/rust-itertools/itertools/issues/984 ))
- Prevented exponentially large type sizes in `tuple_combinations`
([#​945](https://redirect.github.com/rust-itertools/itertools/issues/945 ))
- Added `track_caller` attr for `asser_equal`
([#​976](https://redirect.github.com/rust-itertools/itertools/issues/976 ))
##### Notable Internal Changes
- Fixed clippy lints
([#​956](https://redirect.github.com/rust-itertools/itertools/issues/956 ),
[#​987](https://redirect.github.com/rust-itertools/itertools/issues/987 ),
[#​1008](https://redirect.github.com/rust-itertools/itertools/issues/1008 ))
- Addressed warnings within doctests
([#​964](https://redirect.github.com/rust-itertools/itertools/issues/964 ))
- CI: Run most tests with miri
([#​961](https://redirect.github.com/rust-itertools/itertools/issues/961 ))
- CI: Speed up "cargo-semver-checks" action
([#​938](https://redirect.github.com/rust-itertools/itertools/issues/938 ))
- Changed an instance of `default_features` in `Cargo.toml` to
`default-features`
([#​985](https://redirect.github.com/rust-itertools/itertools/issues/985 ))
</details>
---
### Configuration
📅 **Schedule**: Branch creation - "before 5am on the first day of the
month" (UTC), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/rust-lang/cargo ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS44NS4wIiwidXBkYXRlZEluVmVyIjoiMzkuODUuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->
2025-01-01 16:34:23 +00:00
Ed Page
876f17d46b
chore(ci): Ensure JSON schema gets updated
2025-01-01 10:16:18 -06:00
Ed Page
729776b589
fix(schema): Correct and update the JSON Schema
...
Fixes #14999
2025-01-01 10:14:31 -06:00
Weihang Lo
03a5f111b1
fix: env table config can't trigger rebuild with rerun-if-env-changed
. ( #14756 )
...
### What does this PR try to resolve?
As #10358 said, `When a build.rs script emits
cargo:rerun-if-env-changed, it is not re-run when the value of the
specified variable is changed via the env configuration.`
Fixes #10358
### How should we test and review this PR?
Add test bofore fixing to reflect the issue, the next commit fixed it.
### Additional information
The PR is a sucessor of https://github.com/rust-lang/cargo/pull/14058 ,
so the previous dicussion can be refer to it.
2025-01-01 06:46:41 +00:00
Lin Yihai
76ffbe0571
fix: envs in config can trigger rebuild by custom build script with rerun-if-env-changed
.
2025-01-01 14:10:00 +08:00
Weihang Lo
3dabdcdd20
perf(cargo-package): match certain path prefix with pathspec
...
`check_repo_state` checks the entire git repo status.
This is usually fine if you have only a few packages in a workspace.
For huge monorepos, it may hit performance issues.
For example,
on awslabs/aws-sdk-rust@2cbd34d
the workspace has roughly 434 members to publish.
`git ls-files` reported us 204379 files in this Git repository.
That means git may need to check status of all files 434 times.
That would be `204379 * 434 = 88,700,486` checks!
Moreover, the current algorithm is finding the intersection of
`PathSource::list_files` and `git status`.
It is an `O(n^2)` check.
Let's assume files are evenly distributed into each package,
so roughly 470 files per package.
If we're unlucky to have some dirty files, say 100 files.
We will have to do `470 * 100 = 47,000` times of path comparisons.
Even worse, because we `git status` everything in the repo,
we'll have to it for all members,
even when those dirty files are not part of the current package in question.
So it becomes `470 * 100 * 434 = 20,398,000`!
Instead of comparing with the status of the entire repository,
this patch use the magic pathspec[1] to tell git only reports
paths that match a certain path prefix.
This wouldn't help the `O(n^2)` algorithm,
but at least it won't check dirty files outside the current package.
Also, we don't `git status` against entire git worktree/index anymore.
[1]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec
2024-12-31 21:56:49 -05:00
Weihang Lo
61d587fbf4
chore(deps): update alpine docker tag to v3.21 ( #14995 )
...
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| alpine | final | minor | `3.20` -> `3.21` |
---
### Configuration
📅 **Schedule**: Branch creation - "before 5am on the first day of the
month" (UTC), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/ ).
View the [repository job
log](https://developer.mend.io/github/rust-lang/cargo ).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS44NS4wIiwidXBkYXRlZEluVmVyIjoiMzkuODUuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->
2025-01-01 02:56:30 +00:00
renovate[bot]
fb55f9b311
chore(deps): update rust crate itertools to 0.14.0
2025-01-01 02:26:09 +00:00
renovate[bot]
5f42cf2873
chore(deps): update alpine docker tag to v3.21
2025-01-01 02:26:01 +00:00
Ed Page
d85d76199f
fix(package): check dirtiness of symlinks source files ( #14981 )
...
### What does this PR try to resolve?
This adds a special case for checking source files are symlinks
and have been modified when under a VCS control
This is required because those paths may link to a file outside the
current package root, but still under the git workdir, affecting the
final packaged `.crate` file.
### How should we test and review this PR?
Pretty similar to #14966 , as a part of #14967 .
This may have potential performance issue. If a package contains
thousands of symlinks, Cargo will fire `git status` for each of them.
Not sure if we want to do anything proactively now.
The introduction of the `PathEntry` struct gives us more room for
storing file metadata to satisfiy use cases in the future. For
instances,
* Knowing a source file is a symlink and resolving it when packaging on
Windows
* #5664
* #14965
* Knowing more about a file's metadata (e.g. permission bits from Git)
* #4413
* #8006
* Provide richer information for `cargo package --list`, for example
JSON output mode
* #11666
* #13331
* #13953
2024-12-31 22:44:40 +00:00
Weihang Lo
24dd205d5a
fix(package): deduplicate dirty symlink detection
...
metdata path fields may point to a dirty symlilnk and cause
duplicate report. This commit combines `dirty_metadata_paths`
and `dirty_symlinks` into one so is able to de-duplicate them.
2024-12-31 16:25:31 -05:00
Weihang Lo
de39f59e26
fix(package): check dirtiness of symlink source files
...
This adds a special case for checking source files are symlinks
and have been modified when under a VCS control
This is required because those paths may link to a file outside the
current package root, but still under the git workdir, affecting the
final packaged `.crate` file.
This may have potential performance issue. If a package contains
thousands of symlinks, Cargo will fire `git status` for each of them.
2024-12-31 16:25:31 -05:00
Weihang Lo
014e516e74
test(package): symlink dirty also under dirtiness check
...
This show that a regular file under a symlink directory
is also not tarcked by the current vcs dirtiness check.
2024-12-31 16:25:31 -05:00
Weihang Lo
aaac6887c6
refactor(source): preserve whether a path is under a symlink dir
...
This is helpful for VCS status check.
Paths emitted by PathSource are always under package root,
We lose the track of file type info of paths under symlink dirs,
so we need this extra bit of information.
2024-12-31 16:25:30 -05:00
Weihang Lo
081545ff2a
refactor(package): simplify metadata path field report path join
...
`abs_path` and `workdir.join(rel_path)` are the same at that point.
2024-12-31 16:21:44 -05:00
Weihang Lo
4c06c57d0d
refactor(cargo-util): one generic for each argument
...
So `path` and `base` are able to accept different types
2024-12-31 16:21:43 -05:00
Ed Page
d73d2caf9e
fix(package): warn if symlinks checked out as plain text files ( #14994 )
...
### What does this PR try to resolve?
`cargo package` will warn users when git `core.symlinks` is `false`
and some symlinks were checked out as plain files during packaging.
Git config [`core.symlinks`] defaults to true when unset.
In git-for-windows (and git as well),
the config should be set to false explicitly when the repo was created,
if symlink support wasn't detected [^1].
We assume the config was always set at creation time and never changed.
So, if it is true, we don't bother users with any warning.
[^1]:
f1241afcc7/setup.c (L2394-L2403)
[`core.symlinks`]:
https://git-scm.com/docs/git-config#Documentation/git-config.txt-coresymlinks
### How should we test and review this PR?
CI passes.
This shares two commits 42dc4eff43ce480350979e07c8605e0f12983b79 and
c8c8223c265ba8e7ea4cd29f829583ce786834f6 with #14981 .
I didn't commit to fix all symlink issues all at once.
This PR demonstrates how we could leverage metadata in `PathEntry`.
Maybe later we can really follow plain-text symlinks and resolve the
issue.
### Additional information
cc #5664
0.86.0
2024-12-31 20:51:21 +00:00
Weihang Lo
059fe16085
fix(package): warn if symlinks checked out as plain text files
...
`cargo package` will warn users when git `core.symlinks` is `false`
and some symlinks were checked out as plain files during packaging.
Git config [`core.symlinks`] defaults to true when unset.
In git-for-windows (and git as well),
the config should be set to false explicitly when the repo was created,
if symlink support wasn't detected [^1].
We assume the config was always set at creation time and never changed.
So, if it is true, we don't bother users with any warning.
[^1]: <f1241afcc7/setup.c (L2394-L2403)
>
[`core.symlinks`]: https://git-scm.com/docs/git-config#Documentation/git-config.txt-coresymlinks
2024-12-31 14:19:55 -05:00
Weihang Lo
871b17f59a
test(package): show behavior with core.symlinks=false
2024-12-31 11:52:44 -05:00
Weihang Lo
8adbe0eb06
refactor(package): preserve file type information in PathEntry
...
So that we can tell whether a path is a symlink and need to
traverse to the actual file to check dirtiness or copy real content.
2024-12-31 11:49:51 -05:00
Weihang Lo
1df629b2fa
refactor(source): wrap PathBuf
with PathEntry
...
This gives us more room to store file metadata.
For example,
* knowing a source file is a symlink and resolving it when packaging,
* providing a rich JSON output for `cargo package --list`
* enriching the `.cargo-vcs-info.json` with copied/symlinked file info
2024-12-31 11:49:35 -05:00