Skip to content
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

Add empty workspace to Cargo.toml #738

Merged

Conversation

yuvald-sweet-security
Copy link
Contributor

@yuvald-sweet-security yuvald-sweet-security commented Dec 19, 2024

This fixes an issue that arises when the package is installed with pre-commit into a cache directory that is itself a subdirectory of a Cargo workspace, making Cargo think it's a package that should have been a part of the parent workspace.

An unexpected error has occurred: CalledProcessError: command: ('/usr/local/cargo/bin/cargo', 'install', '--bins', '--root', '/builds/project/.cache/pre-commit/repot501w21b/rustenv-system', '--path', '.')
return code: 101
stdout: (none)
stderr:
    error: current package believes it's in a workspace when it's not:
    current:   /builds/project/.cache/pre-commit/repot501w21b/Cargo.toml
    workspace: /builds/project/Cargo.toml
    
    this may be fixable by adding `.cache/pre-commit/repot501w21b` to the `workspace.members` array of the manifest located at: /builds/project/Cargo.toml
    Alternatively, to keep it out of the workspace, add the package to the `workspace.exclude` array, or add an empty `[workspace]` table to the package's manifest.
Check the log at /builds/project/.cache/pre-commit/pre-commit.log

@Jake-Shadle
Copy link
Member

This breaks the various integration tests because there are child crates used for test data, if you fix all of them I'll merge this.

@yuvald-sweet-security yuvald-sweet-security force-pushed the pre-commit-workspace branch 2 times, most recently from 4e435dd to 4bfef62 Compare December 22, 2024 08:33
This fixes an issue that arises when the package is installed with pre-commit into a cache directory that is itself a subdirectory of a Cargo workspace, making Cargo think it's a package that should have been a part of the parent workspace.
@yuvald-sweet-security
Copy link
Contributor Author

This now passes tests locally for me

@Jake-Shadle Jake-Shadle merged commit f6e40d8 into EmbarkStudios:main Dec 22, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants