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

move file-extension based .gitignore down to src/ #53768

Merged
merged 1 commit into from
Aug 31, 2018

Conversation

RalfJung
Copy link
Member

Currently, it for example ignores *.rlib files in the repository root -- which I think is wrong; I sometimes get these files when I call rustc directly and I do want them cleaned up, not ignored. No such files are created during the normal build process.

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 28, 2018
@nikomatsakis
Copy link
Contributor

@bors r+ rollup

no strong opinion here

@bors
Copy link
Contributor

bors commented Aug 28, 2018

📌 Commit 6628d39 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 28, 2018
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Aug 28, 2018
move file-extension based .gitignore down to src/

Currently, it for example ignores `*.rlib` files in the repository root -- which I think is wrong; I sometimes get these files when I call rustc directly and I do want them cleaned up, not ignored. No such files are created during the normal build process.
@uberjay
Copy link

uberjay commented Aug 29, 2018

At the risk of commenting without fully understanding what's going on here:

I find this confusing -- doesn't it effectively say that you want git to track changes in the repo root for files with these extensions? Meaning, with this change running git add -A would (incorrectly) stage .rlib files in the repo root into the git index.

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Aug 29, 2018
move file-extension based .gitignore down to src/

Currently, it for example ignores `*.rlib` files in the repository root -- which I think is wrong; I sometimes get these files when I call rustc directly and I do want them cleaned up, not ignored. No such files are created during the normal build process.
@nikomatsakis
Copy link
Contributor

I find this confusing -- doesn't it effectively say that you want git to track changes in the repo root for files with these extensions? Meaning, with this change running git add -A would (incorrectly) stage .rlib files in the repo root into the git index.

That is correct; on the other hand, git clean will delete those files.

Maybe I was hasty in r+'ing, though, and should have done a broader survey. My bad.

cc @rust-lang/compiler @rust-lang/libs and other people who hack on this repo. Do you have opinions? :)

@nagisa
Copy link
Member

nagisa commented Aug 29, 2018

I don’t mind this change. I doubt people with a habit of littering around their repository will be using git add -A anyway and having git clean work for people who do have random files lying around in repository root is a huge boon.

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Aug 29, 2018
move file-extension based .gitignore down to src/

Currently, it for example ignores `*.rlib` files in the repository root -- which I think is wrong; I sometimes get these files when I call rustc directly and I do want them cleaned up, not ignored. No such files are created during the normal build process.
@RalfJung
Copy link
Member Author

RalfJung commented Aug 29, 2018

The way I use git (and, from my experience, the way it is frequently used), .gitignore is for files that are expected to be there but should not be committed -- generally, files created by compilation. This is so that if there is any unexpected data in the repository, git will be able to know and tell me, and git clean will be able to clean it up. I noticed that git failed to inform me about some unexpected files in the repository root, hence this PR. I think the .gitignore here is still way less precise than it could be but I just don't know enough about how Rust is compiled to improve it. Are there ever any files expected to be generated in src/? If not, I'd vote for even removing src/.gitignore.

I wasn't aware people would do git add -A without checking git status what it is they are adding; that must be a workflow rather different from mine. If that's common enough I suppose we should stop this PR. Notice, however, that it is easy for such people to locally extend the files ignored by git by editing .git/info/exclude. I know of no way to locally "unignore" a file.

@nikomatsakis
Copy link
Contributor

I tend to agree with @nagisa and @RalfJung — knowing which "stray files" are hanging around is fairly useful for me so I can keep my directories tidy. (And, as @RalfJung pointed out, one can locally extend the set of files to ignore with relative ease (which I also do))

@uberjay
Copy link

uberjay commented Aug 29, 2018

Yeah, I actually would be pretty surprised if anyone used git add -A, too, I was using it a a shorthand for "files I wouldn't want to add should be ignored". However, after reading your explanation, I get it!

It makes sense to only ignore files which are expected to be created! Thanks for humoring me. :)

pietroalbini added a commit to pietroalbini/rust that referenced this pull request Aug 30, 2018
move file-extension based .gitignore down to src/

Currently, it for example ignores `*.rlib` files in the repository root -- which I think is wrong; I sometimes get these files when I call rustc directly and I do want them cleaned up, not ignored. No such files are created during the normal build process.
bors added a commit that referenced this pull request Aug 31, 2018
Rollup of 20 pull requests

Successful merges:

 - #51760 (Add another PartialEq example)
 - #53113 (Add example for Cow)
 - #53129 (remove `let x = baz` which was obscuring the real error)
 - #53389 (document effect of join on memory ordering)
 - #53472 (Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.)
 - #53476 (Add partialeq implementation for TryFromIntError type)
 - #53513 (Force-inline `shallow_resolve` at its hottest call site.)
 - #53655 (set applicability)
 - #53702 (Fix stabilisation version for macro_vis_matcher.)
 - #53727 (Do not suggest dereferencing in macro)
 - #53732 (save-analysis: Differentiate foreign functions and statics.)
 - #53740 (add llvm-readobj to llvm-tools-preview)
 - #53743 (fix a typo: taget_env -> target_env)
 - #53747 (Rustdoc fixes)
 - #53753 (expand keep-stage --help text)
 - #53756 (Fix typo in comment)
 - #53768 (move file-extension based .gitignore down to src/)
 - #53785 (Fix a comment in src/libcore/slice/mod.rs)
 - #53786 (Replace usages of 'bad_style' with 'nonstandard_style'.)
 - #53806 (Fix UI issues on Implementations on Foreign types)

Failed merges:

r? @ghost
@bors
Copy link
Contributor

bors commented Aug 31, 2018

☔ The latest upstream changes (presumably #53832) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 31, 2018
@bors bors merged commit 6628d39 into rust-lang:master Aug 31, 2018
@RalfJung RalfJung deleted the gitignore branch September 1, 2018 09:06
@petrochenkov
Copy link
Contributor

Oh no.

I sometimes get these files when I call rustc directly and I do want them cleaned up

I often call rustc directly too, like this or similar

build/x86_64-pc-windows-gnu/stage1/bin/rustc ../mytest.rs

and I want the produced files to be ignored, so they do not litter git-gui or git status.

This is so that if there is any unexpected data in the repository, git will be able to know and tell me

In my case this is expected temporary data in the repository, exactly something that needs to be ignored.
So, this breaks my workflow.

@crlf0710
Copy link
Member

crlf0710 commented Sep 1, 2018

@petrochenkov maybe you can edit your .git/info/exclude and add them back... which only affects your local copy. It's not a big deal.

Centril added a commit to Centril/rust that referenced this pull request Aug 8, 2019
gitignore: add comment explaining policy

Based on rust-lang#63307 (comment), I added a comment what I think should be gitignored and what not. This is just a proposal, obviously.  Also see rust-lang#53768 for some more discussion.

The summary is that if there are junk files that you create locally and are fine leaving around (such as `mir_dump`), git has the option for you to add them to `.git/info/exclude`. Others might prefer to keep their working dir clean of those same junk files, so we shouldn't just ignore them for everyone.

I then also cleaned up a few more things, but there were many things that I had no idea where they came from so I didn't touch them.
Centril added a commit to Centril/rust that referenced this pull request Aug 8, 2019
gitignore: add comment explaining policy

Based on rust-lang#63307 (comment), I added a comment what I think should be gitignored and what not. This is just a proposal, obviously.  Also see rust-lang#53768 for some more discussion.

The summary is that if there are junk files that you create locally and are fine leaving around (such as `mir_dump`), git has the option for you to add them to `.git/info/exclude`. Others might prefer to keep their working dir clean of those same junk files, so we shouldn't just ignore them for everyone.

I then also cleaned up a few more things, but there were many things that I had no idea where they came from so I didn't touch them.
Centril added a commit to Centril/rust that referenced this pull request Oct 21, 2019
…um,Centril

keep the root dir clean from debugging

We landed this before with rust-lang#63307 but recently in rust-lang#65630 the IMO bad ignore crept back in.

If you regularly do graphviz-based debugging and you are fine leaving junk in the rustc root dir, please configure your local `.git/info/exclude`. But most people working on rustc don't work with graphciz all that often (I for once never did), and not everyone likes to have stray generated files in their source dirs.

Also Cc rust-lang#63373 rust-lang#53768 @ecstatic-morse @Mark-Simulacrum
Centril added a commit to Centril/rust that referenced this pull request Oct 21, 2019
…um,Centril

keep the root dir clean from debugging

We landed this before with rust-lang#63307 but recently in rust-lang#65630 the IMO bad ignore crept back in.

If you regularly do graphviz-based debugging and you are fine leaving junk in the rustc root dir, please configure your local `.git/info/exclude`. But most people working on rustc don't work with graphciz all that often (I for once never did), and not everyone likes to have stray generated files in their source dirs.

Also Cc rust-lang#63373 rust-lang#53768 @ecstatic-morse @Mark-Simulacrum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants