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

publish ignores dirty files that release does not #336

Closed
asomers opened this issue Sep 29, 2021 · 4 comments
Closed

publish ignores dirty files that release does not #336

asomers opened this issue Sep 29, 2021 · 4 comments
Labels
bug Not as expected

Comments

@asomers
Copy link

asomers commented Sep 29, 2021

I always create a target symlink in each workspace, to store Cargo's generated files on a different file system. But cargo release warns about it, like this:

[2021-09-29T03:21:18Z DEBUG cargo_release::git] Dirty because of:
    target
[2021-09-29T03:21:18Z ERROR cargo_release] Uncommitted changes detected for nix, please commit before release.

That forces me to delete the symlink before running cargo release, which then causes cargo publish to recreate the target directory, but this time as a regular directory instead of a symlink.

Would it be possible to make cargo-release ignore target when doing its git dirty check?

@epage
Copy link
Collaborator

epage commented Sep 29, 2021

Does cargo publish complain about the symlink?

Whats your .gitignore look like?

btw have you considered setting CARGO_TARGET_DIR?
https://doc.rust-lang.org/cargo/reference/environment-variables.html

@asomers
Copy link
Author

asomers commented Sep 29, 2021

CARGO_TARGET_DIR is close, but not good enough, because it needs to be set individually for each workspace. The proposed CARGO_TARGET_DIR_PREFIX variable would solve the problem completely.
rust-lang/cargo#5544
cargo publish --dry-run does not complain about target. The .gitignore file contains target/. But now that you mention it, the trailing slash might be confusing git. If I remove that, then git status shuts up about target. Would that stop cargo-release's warning?

@epage
Copy link
Collaborator

epage commented Sep 29, 2021

Yes, that should quiet cargo-release.

There is still an issue with cargo publish and cargo-release identifying dirty files in different ways.

@epage epage added the bug Not as expected label Sep 29, 2021
@epage epage changed the title Don't warn about a "target" symlink publish ignores dirty files that release does not Sep 29, 2021
epage added a commit to epage/cargo-release that referenced this issue Jan 7, 2022
When skipping consolidated commits, we check each released packages
directory for dirty but we commit files in all locations.  We need to
commit all because editing a package can modify the lock file or other
crate's dependencies.  So we change the dirty check to match commit.

Inspired by crate-ci#336
@epage
Copy link
Collaborator

epage commented Jan 7, 2022

There is still an issue with cargo publish and cargo-release identifying dirty files in different ways.

Just remembered that we have to be more generous than cargo publish because we we modify files not checked by cargo publish (lock file, dependent Cargo.toml, anything touched by replacements or hooks).

In fact, we need to be more generous than we currently are, so created #391

@epage epage closed this as completed Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not as expected
Projects
None yet
Development

No branches or pull requests

2 participants