14103 Commits

Author SHA1 Message Date
Scott Schafer
34b8c39d77 chore: Use [workspace.dependencies] 2023-04-28 09:56:09 -05:00
bors
2f06c80bd0 Auto merge of #11840 - Byron:shallow-support, r=weihanglo
support for shallow clones and fetches with `gitoxide`

This PR makes it possible to enable shallow clones and fetches for git dependencies and crate indices independently with the `-Zgitoxide=fetch,shallow_deps` and `-Zgitoxide=fetch,shallow_index` respectively.

### Tasks

* [x] setup the shallow option when fetching, differentiated by 'registry' and 'git-dependency'
* [x] validate registries are cloned shallowly *and* fetched shallowly
* [x] validate git-dependencies are cloned shallowly *and* fetched shallowly
* [x] a test to show what happens if a shallow index is opened with `git2` (*it can open it and fetch like normal, no issues*)
* [x] assure that `git2` can safely operate on a shallow clone - we unshallow it beforehand, both for registries and git dependencies
* [x] assure git-deps with revisions are handled correctly (they should just not be shallow, and they should unshallow themselves if they are)
* [x] make sure shallow index clones aren't seen by older cargo's
* [x] make sure shallow git dependency clones aren't seen by older cargo's
* [x] shallow.lock test and more test-suite runs with shallow clones enabled for everything
* [x] release new version of `gix` with full shallow support and use it here
* [x] check why `shallow` files remain after unshallowing. Should they not rather be deleted if empty? - Yes, `git` does so as well, implemented [with this commit](2cd5054b0a)
* ~~see if it can be avoided to ever unshallow an existing `-shallow` clone by using the right location from the start. If not, test that we can go `shallow->unshallow->shallow` without a hitch.~~ Cannot happen anymore as it can predict the final location perfectly.
* [x] `Cargo.lock` files don't prevent shallow clones
* [x] assure all other tests work with shallow cloning enabled (or fix the ones that don't with regression protection)
* [x] can the 'split-brain' issue be solved for good?

### Review Notes

* there is a chance of 'split brain' in git-dependencies  as the logic for determining whether the clone/fetch is shallow is repeated in two places. This isn't the case for registries though.

### Notes

* I am highlighting that this is the `gitoxide` version of shallow clones as the `git2` version [might soon be available](https://github.com/libgit2/libgit2/pull/6396) as well. Having that would be good as it would ensure interoperability remains intact.
* Maybe for when `git2` has been phased out, i.e. everything else is working, I think (unscientifically) there might be benefits  in using worktrees for checkouts. Admittedly I don't know the history of why they weren't used in the first place. Also: `gitoxide` doesn't yet support local clones and might not have to if worktrees were used instead.
2023-05-03 07:12:20 +00:00
Sebastian Thiel
d2734d305b
Update unstable.md with new gitoxide options for shallow clones
Co-authored-by: Weihang Lo <me@weihanglo.tw>
2023-05-03 08:53:23 +02:00
bors
a9465fe751 Auto merge of #12015 - tedinski:fix-11999-recursive-deps, r=weihanglo
Build by PackageIdSpec, not name, to avoid ambiguity

### What does this PR try to resolve?

Fixes #11999

I previously added this code to ensure `cargo install` will build the intended package, but it turns out to cause ambiguity in the case where a package depends on prior versions of itself.

This ambiguity can be resolved by identifying the package to build by its pkg-spec, not name.

### How should we test and review this PR?

A test case is included.

I have additionally manually tested that, with this patch, the issue in #11999 is fixed and now installs correctly.
2023-05-03 00:07:32 +00:00
Weihang Lo
7fb35c9c4e
test(install): correct the term workspace -> local packagd 2023-05-03 01:04:18 +01:00
Sebastian Thiel
3bd08d934b
Move helper functions to the bottom for consistency; fix name 2023-05-02 18:57:42 +02:00
bors
ac84010322 Auto merge of #12068 - Bhardwaj-Himanshu:#12056, r=weihanglo
docs(registry): Further specify owner-remove response (#12056)

### What does this PR try to resolve?

This fixes a documentation issue as mentioned in #12056.

### How should we test and review this PR?

This is just a markdown file change, so it does not break anything.

### Additional information

Let me know if you have any changes or suggestions or how to write the tests for markdown files as well!

Thanks
2023-05-02 13:41:16 +00:00
Bhardwaj-Himanshu
eedb468762 docs(registry): further specify owner-remove response 2023-05-02 19:02:23 +05:30
bors
ba45764a2c Auto merge of #12067 - cuishuang:master, r=weihanglo
Remove repeated definite articles

Remove repeated definite articles
2023-05-02 11:08:35 +00:00
Ted Kaminski
79bb2d7143 Update pkg-spec comment, and add 2 more test cases 2023-05-01 17:23:17 -05:00
Ted Kaminski
e97cc80d9a Determine pkg-spec from workspace, not original package which may be a git url 2023-05-01 17:23:17 -05:00
Ted Kaminski
31d679e81a Build by PackageIdSpec, not name, to avoid ambiguity 2023-05-01 17:23:17 -05:00
bors
c455de990c Auto merge of #10877 - obi1kenobi:adding-non-exhaustive, r=weihanglo
Document that adding `#[non_exhaustive]` on existing items is breaking.

### What does this PR try to resolve?

Adding `#[non_exhaustive]` to an existing struct, enum, or variant is almost always a breaking change and requires a major version bump for semver purposes. This PR adds a section to the semver reference page that describes this and provides examples showing how `#[non_exhaustive]` can break code.

### Additional information

Adding `#[non_exhaustive]` to a unit struct currently has no effect on whether that struct can be constructed in downstream crates. This is inconsistent with the behavior of `#[non_exhaustive]` on unit enum variants, which may not be constructed outside their own crate. This might be due to a similar underlying cause as: https://github.com/rust-lang/rust/issues/78586

The confusing "variant is private" error messages for non-exhaustive unit and tuple variants are a known issue tracked in: https://github.com/rust-lang/rust/issues/82788

Checking for the struct portion of this semver rule is done in: https://github.com/obi1kenobi/cargo-semver-check/pull/4
2023-05-01 21:21:45 +00:00
bors
93f7b782d0 Auto merge of #12073 - roj1512:patch-1, r=arlosi
docs(commands): add missed preposition
2023-05-01 18:19:00 +00:00
Eric Huss
f18f7f1240 Add some clarifications on what happens when non_exhaustive is added. 2023-05-01 11:15:37 -07:00
Predrag Gruevski
c4ce40c37f Fix non_exhaustive formatting to rustfmt's liking. 2023-05-01 11:01:29 -07:00
Predrag Gruevski
2451c2d3ba Match up enums in the example. 2023-05-01 11:01:29 -07:00
Predrag Gruevski
512f12246e More formatting tweaks. 2023-05-01 11:01:29 -07:00
Predrag Gruevski
08c4f92273 Tweak example formatting. 2023-05-01 11:01:29 -07:00
Predrag Gruevski
fc77710e07 Fix example code. 2023-05-01 11:01:29 -07:00
Predrag Gruevski
61cd0a84d7 Document that adding #[non_exhaustive] is a major breaking change. 2023-05-01 11:01:29 -07:00
Roj
c4ba59f57b
cargo build-man 2023-05-01 19:49:04 +03:00
Roj
8af33b33c3
Change the right file 2023-05-01 19:48:33 +03:00
Roj
ec80f4ecd2
docs(commands): add missed preposition 2023-05-01 18:05:33 +03:00
cui fliter
825c75af31 Remove repeated definite articles
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-05-01 21:37:28 +08:00
bors
ee7f4c3b3d Auto merge of #12065 - loongarch-rs:fix-unused-mut, r=weihanglo
Fix warning with unused mut

### What does this PR try to resolve?

```
warning: variable does not need to be mutable
   --> src/cargo/core/compiler/unit_dependencies.rs:152:5
    |
152 |     mut state: &mut State<'_, '_>,
    |     ----^^^^^
    |     |
    |     help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

warning: `cargo` (lib) generated 1 warning (run `cargo fix --lib -p cargo` to apply 1 suggestion)
```

This is caused by https://github.com/rust-lang/rust/pull/110960

### How should we test and review this PR?

Running the mainline rust toolchain and `cargo build` without any wanrning messages would look like the above.

### Additional information

None
2023-05-01 07:04:44 +00:00
WANG Rui
b0a31036a6 Fix warning with unused mut
This is caused by https://github.com/rust-lang/rust/pull/110960
2023-05-01 10:41:06 +08:00
Sebastian Thiel
2aaebcbcaa
Only fetch single object in shallow mode for compatibility 2023-04-29 14:29:11 +02:00
Sebastian Thiel
99316c8e43
set openssl-src to specific version
This recreates the previously lost change from https://github.com/rust-lang/cargo/pull/12005.
2023-04-29 14:20:10 +02:00
Sebastian Thiel
d4b8fc68ab
Allow fetching a single object, shallow or not.
Doing so seems cleaner as there should be no logical difference between
shallow or not-shallow when fetching. We want a specific object, and should
get it with the refspec. `git` will assure we see all objects we need,
handling shallow-ness for us.

Note that one test needed adjustments due to the different mechanism used
when fetching local repositories, requiring more changes to properly 'break'
the submodule repo when `gitoxide` is used.
2023-04-29 12:21:45 +02:00
Weihang Lo
e20b020d60
refactor: remove locked_rev arg
If there is a locked revision, it should substitue for git reference.
There is no chance that we will fallback to git reference when locked
revision exists.
2023-04-29 10:24:35 +02:00
Weihang Lo
e2fe3956f9
refactor: determine how shallow clone is handled inside fetch fn
I think `RemoteKind::to_shallow_setting` should be an implementation
detail of `fetch` fn.
2023-04-29 10:18:54 +02:00
Sebastian Thiel
8b3508cad7
Move all tests for shallow fetching into their own module
Note that those which test both with and without shallow still go
into the shallow module.
2023-04-29 09:52:08 +02:00
Sebastian Thiel
493574eb2e
Don't exclude github fast path in shallow clones
It was misunderstood earlier and it's something we'd want as
it will quickly conclude that the remote didn't change compared
to a reference we would otherwise try to update.
2023-04-29 09:32:52 +02:00
bors
393ce5b416 Auto merge of #12048 - weihanglo:mdman, r=epage
chore: move build-man workflow away from shell
2023-04-28 15:48:53 +00:00
bors
7a90ba1ecc Auto merge of #12043 - epage:rust-version, r=weihanglo
feat: Add `-Zmsrv-policy` feature flag

### What does this PR try to resolve?

Nothing noticeable....

The intent is to unblock experiments with different compatible MSRV policies like
- #9930
- #10653
- #10903

While I normally don't like PRs that do nothing on their own, this at least allows any one of those efforts to move forward with different people without juggling these base commits for whoever is first to include in their PR

While there isn't an RFC for this yet, this is intended to allow us to experiment to get a better idea of what we should put in an RFC.  In some cases, we first do an eRFC for this but I assumed this wouldn't be needed in this case as this builds on rust-lang/rfcs#2495 and, I'm assuming, will be more surgical in nature

### How should we test and review this PR?

The `Summary` changes are largely untested as they will be mostly tested through the future work that builds on this PR.  However, I wasn't too concerned about that because the code is relatively trivial.

### Additional information

I chose the name `msrv-policy` to distinguish this unstable feature from `rust-version`.  Though those appear in different places (`Cargo.toml` vs `-Z`), I can see them being confusing which was especially apparent when editing `unstable.md` which has an anchor for `rust-version`.
2023-04-28 14:55:25 +00:00
Weihang Lo
137c82a54b
mdman: update mdman's example outputs 2023-04-28 15:46:37 +01:00
Weihang Lo
e3dec38f4b
mdman: use cargo build-man everywhere 2023-04-28 15:46:37 +01:00
Weihang Lo
c01bad9b20
mdman: make build-man part of xtask
Turn `src/doc/build-man.sh` into a Cargo binary target.
So is `crates/mdman/build-man.sh`.
2023-04-28 15:46:37 +01:00
Weihang Lo
9c426c90de
mdman: remove dangling Cargo.lock 2023-04-28 15:44:24 +01:00
bors
c8d980c598 Auto merge of #12051 - weihanglo:stale-label, r=epage
chore: new xtask to check stale paths in autolabel defintions
2023-04-28 12:46:42 +00:00
Weihang Lo
36653ab85a
ci: add job stale-label 2023-04-28 12:02:51 +01:00
Weihang Lo
981282891f
xtask-stale-label: check stale paths in autolabel defintions 2023-04-28 12:02:51 +01:00
bors
a285008c8e Auto merge of #12044 - jrose-signal:cargo-tree-no-proc-macro, r=epage
cargo-tree: Handle -e no-proc-macro when building the graph

### What does this PR try to resolve?

Makes `-e no-proc-macro` more useful when combined with `-i` or `-d`. Fixes #12030.

### How should we test and review this PR?

The new and existing tests should cover this, I hope!

### Additional information

Pruning proc-macro crates during graph construction is closer to how the edge-based filters work (`[no-]build` etc.), so even though `no-proc-macro` isn't technically filtering on edges, it's following a well-established code path.
2023-04-27 21:04:25 +00:00
bors
221051e84f Auto merge of #12052 - weihanglo:autolabel-update, r=epage
chore: update trigger_files in autolabel
2023-04-27 19:02:30 +00:00
bors
236ee3de3a Auto merge of #12049 - lukas-code:fix-doc-markdown, r=weihanglo
fix broken markdown in docs

### What does this PR try to resolve?

This PR fixes some broken markdown in doc comments.

### How should we test and review this PR?

1. Navigate to the online docs and observe broken markdown:
    * https://doc.rust-lang.org/nightly/nightly-rustc/cargo/index.html
    * https://doc.rust-lang.org/nightly/nightly-rustc/cargo/core/compiler/struct.TargetInfo.html#structfield.crate_types
    * https://doc.rust-lang.org/nightly/nightly-rustc/cargo/sources/registry/struct.RegistryConfig.html#structfield.dl
    * https://doc.rust-lang.org/nightly/nightly-rustc/cargo/sources/registry/fn.max_unpack_size.html
2. Run `cargo doc --document-private-items --open` and verify that the broken markdown has been fixed.

### Additional information

The broken inline code was found by a [new rustdoc lint](https://github.com/rust-lang/rust/pull/105848) and these changes will be required to deny the lint in the rust-lang/rust repository.
2023-04-27 18:00:54 +00:00
Jordan Rose
a0576d1767 cargo-tree: Handle -e no-proc-macro when building the graph
This is closer to how the edge-based filters work ([no-]build etc.),
and results in a more useful behavior when combined with -i or -d.
2023-04-27 10:54:51 -07:00
Weihang Lo
f92227f7cc
chore: delete removed label needs-mcve 2023-04-27 18:50:50 +01:00
Weihang Lo
41a60d1b87
chore: update trigger files for autolabel 2023-04-27 18:50:50 +01:00
Jordan Rose
747a5924a0 test: Add a test for cargo tree --duplicates with a proc-macro 2023-04-27 10:49:22 -07:00