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

Make target dir self-ignoring #15060

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

senekor
Copy link

@senekor senekor commented Jan 13, 2025

Fixes #15061

How to test:

  • run cargo new, observer that no .gitignore is generated
  • run cargo build, observe that git still ignores the target directory
  • run cargo build with different ways to override the default target directory location:
    • CLI arg (--target-dir)
    • environment variable (CARGO_TARGET_DIR)
    • .cargo/config.toml: build.target-dir

@rustbot
Copy link
Collaborator

rustbot commented Jan 13, 2025

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @epage (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added A-workspaces Area: workspaces Command-new S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 13, 2025
@senekor
Copy link
Author

senekor commented Jan 13, 2025

This is currently a proof of concept, meant as a starting point for discussing how to implement it properly.

The easy approach is to just make sure that the gitignore file exists whenever the target directory path is determined.
This leads to some (maybe unacceptable) quirks.
For example, many cargo commands would touch the file system when the user doesn't expect it (even cargo clean --dry-run creates the gitignore file).

@epage
Copy link
Contributor

epage commented Jan 13, 2025

Note that #11548 is not labeled with S-accepted which is a prerequisite for being reviewed, see https://doc.crates.io/contrib/process/working-on-cargo.html

@senekor
Copy link
Author

senekor commented Jan 13, 2025

makes sense!

@senekor senekor force-pushed the senekor/vlulryonntrl branch from 174d845 to 42a9f08 Compare January 14, 2025 00:40
@senekor
Copy link
Author

senekor commented Jan 14, 2025

I removed the part dealing with cargo new. The PR now points to #15061, which reflects the smaller scope. (approval still pending)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-workspaces Area: workspaces Command-new S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make target dir self-ignoring
3 participants