-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: cargo package
failed on bare commit git repo.
#14359
Conversation
r? @weihanglo rustbot has assigned @weihanglo. Use |
e33f540
to
c8f2734
Compare
It hits the API limit
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
@rfcbot fcp merge This insta-stabilizes an edge case of When a Git repo has no commits, the file content would be {
"git": {
# there is no "sha1" field because `HEAD` is missing
"dirty": true
},
"path_in_vcs": "..."
} Thinking backward from #13695, the requirement is to have commit hash as well as the |
Team member @weihanglo has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
@weihanglo there are several solutions for this
and likely more. Is there a motivation for the proposed solution? I didn't see it here or in the issue. |
I am sorry that I just did a really quick FCP without thinking hard on it. I don't have a good answer. Thinking backward from #13695, the requirement is to have commit hash as well as the However, I personally doubt it is useful in real life, since that happens on in an edge case that no commit exists. I am fine with whatever approach we choose. We just need to fix the regression. |
@weihanglo Thanks you rapidly response. Sorry for that, I had change my mind. I'm not sure if the absence of this field will cause problems in other ways, so it's better to not include/generate the Of course, this is only a reasonable change that I currently feel, which should be very rare for this scenario, and it may be better to maintain the consistency with the previous |
src/cargo/ops/cargo_package.rs
Outdated
git: git(p, src_files, &repo, &opts)?, | ||
path_in_vcs, | ||
})); | ||
let git = git(p, src_files, &repo, &opts)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could fn git()
return a None
when nothing needed to be recorded? So that we don't need skip_serializing_if
for sha1
field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with you and updated it
Agree that not generating vcs info file is also a reasonable approach to take. It stays with the old behavior (not generating when |
Let's discuss different approaches in the issue then. |
This a test to reflect that `cargo package --allow-dirty` will fail on a bare commit git repo
@rustbot fcp cancel until we settle down a solution. |
@rfcbot fcp cancel |
@weihanglo proposal cancelled. |
☀️ Test successful - checks-actions |
Fix: `cargo package` failed on bare commit git repo. ### What does this PR try to resolve? Fixes rust-lang#14354 This approach chose to not generate a `.cargo_vcs_info.json` for bare commit git repo. ### How should we test and review this PR? Compare the test changes before and after the two commits ### Additional information
Update cargo 7 commits in 0d8d22f83b066503f6b2b755925197e959e58b4f..2f738d617c6ead388f899802dd1a7fd66858a691 2024-08-08 12:54:24 +0000 to 2024-08-13 10:57:52 +0000 - chore: downgrade to openssl v1.1.1 (again) (rust-lang/cargo#14391) - feat(trim-paths): rustdoc supports trim-paths for diagnostics (rust-lang/cargo#14389) - Use longhand gitoxide path-spec patterns (rust-lang/cargo#14380) - feat: Add `info` cargo subcommand (rust-lang/cargo#14141) - CI: Switch macos aarch64 to nightly (rust-lang/cargo#14382) - Use context instead of with_context (rust-lang/cargo#14377) - Fix: `cargo package` failed on bare commit git repo. (rust-lang/cargo#14359) r? ghost
Update cargo 7 commits in 0d8d22f83b066503f6b2b755925197e959e58b4f..2f738d617c6ead388f899802dd1a7fd66858a691 2024-08-08 12:54:24 +0000 to 2024-08-13 10:57:52 +0000 - chore: downgrade to openssl v1.1.1 (again) (rust-lang/cargo#14391) - feat(trim-paths): rustdoc supports trim-paths for diagnostics (rust-lang/cargo#14389) - Use longhand gitoxide path-spec patterns (rust-lang/cargo#14380) - feat: Add `info` cargo subcommand (rust-lang/cargo#14141) - CI: Switch macos aarch64 to nightly (rust-lang/cargo#14382) - Use context instead of with_context (rust-lang/cargo#14377) - Fix: `cargo package` failed on bare commit git repo. (rust-lang/cargo#14359) r? ghost
Update cargo 7 commits in 0d8d22f83b066503f6b2b755925197e959e58b4f..2f738d617c6ead388f899802dd1a7fd66858a691 2024-08-08 12:54:24 +0000 to 2024-08-13 10:57:52 +0000 - chore: downgrade to openssl v1.1.1 (again) (rust-lang/cargo#14391) - feat(trim-paths): rustdoc supports trim-paths for diagnostics (rust-lang/cargo#14389) - Use longhand gitoxide path-spec patterns (rust-lang/cargo#14380) - feat: Add `info` cargo subcommand (rust-lang/cargo#14141) - CI: Switch macos aarch64 to nightly (rust-lang/cargo#14382) - Use context instead of with_context (rust-lang/cargo#14377) - Fix: `cargo package` failed on bare commit git repo. (rust-lang/cargo#14359) r? ghost
Update cargo 7 commits in 0d8d22f83b066503f6b2b755925197e959e58b4f..2f738d617c6ead388f899802dd1a7fd66858a691 2024-08-08 12:54:24 +0000 to 2024-08-13 10:57:52 +0000 - chore: downgrade to openssl v1.1.1 (again) (rust-lang/cargo#14391) - feat(trim-paths): rustdoc supports trim-paths for diagnostics (rust-lang/cargo#14389) - Use longhand gitoxide path-spec patterns (rust-lang/cargo#14380) - feat: Add `info` cargo subcommand (rust-lang/cargo#14141) - CI: Switch macos aarch64 to nightly (rust-lang/cargo#14382) - Use context instead of with_context (rust-lang/cargo#14377) - Fix: `cargo package` failed on bare commit git repo. (rust-lang/cargo#14359) r? ghost
What does this PR try to resolve?
Fixes #14354
This approach chose to not generate a
.cargo_vcs_info.json
for bare commit git repo.How should we test and review this PR?
Compare the test changes before and after the two commits
Additional information