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

'cargo new' and .gitignores #304

Closed
steveklabnik opened this issue Aug 1, 2014 · 7 comments · Fixed by #321
Closed

'cargo new' and .gitignores #304

steveklabnik opened this issue Aug 1, 2014 · 7 comments · Fixed by #321

Comments

@steveklabnik
Copy link
Member

Now that we have Cargo.lock, we should take the opportunity to encourage good habits with regards to it and source control.

Basically, what I'm imagining is that cargo new, when making a binary, should not add Cargo.lock to the ignore. And when making a library, should add it to the gitignore.

What'cha think?

@alexcrichton
Copy link
Member

This is what I would expect, @wycats?

@wycats
Copy link
Contributor

wycats commented Aug 2, 2014

Agreed fully.

@Earnestly
Copy link

Please don't enforce bad practices (such as using .gitignore files) on users without offering a mechanism to opt-out.

Adding files to a .gitignore comes from the idea of blacklists, a.k.a. default-permit and enumerating-badness which are known poor practices in security. A better practice would be to exclude everything via .git/info/exclude (or setting --global core.excludesfile ...) and adding *. Every file you want tracked needs to be added explicitly via add -f.

A better solution would be simply do nothing instead of trying to second guess what a user might want, at least not until it is configurable.

@wycats
Copy link
Contributor

wycats commented Aug 3, 2014

The opt-out is rm .gitignore or not using the generator to begin.

Not sure how defaults in a generator can be considered "forcing" anything on anyone.

@Earnestly
Copy link

You're opting to creating junk files which are not related to the tool by default which is not configurable, I really dislike this behaviour and don't really consider it acceptable without it being optional.

It also rubs me the wrong way when others make these choices based on what they believe to be "encouraging good habits" without any justification, merely what appears to be axiomatic to them.

@tomaka
Copy link
Contributor

tomaka commented Aug 4, 2014

I have nothing against git, but I don't like the fact that Cargo creates a .gitignore, whatever is in it.
I don't like when two unrelated tools (cargo and git) are tied together.

@alexcrichton
Copy link
Member

Note that git is turned off by default and you have to enable it with a --git flag to cargo new

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Aug 4, 2014
The lockfile should only be checked in for bins, not libs.

Closes rust-lang#304
bors added a commit that referenced this issue Aug 6, 2014
The lockfile should only be checked in for bins, not libs.

Closes #304
@bors bors closed this as completed in #321 Aug 6, 2014
alexcrichton added a commit to alexcrichton/cargo that referenced this issue Sep 2, 2014
The lockfile should only be checked in for bins, not libs.

Closes rust-lang#304
bors added a commit to alexcrichton/cargo that referenced this issue Sep 2, 2014
The lockfile should only be checked in for bins, not libs.

Closes rust-lang#304
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 a pull request may close this issue.

5 participants