Skip to content

Commit

Permalink
Ignore Cargo.lock for libs in cargo-new
Browse files Browse the repository at this point in the history
The lockfile should only be checked in for bins, not libs.

Closes #304
  • Loading branch information
alexcrichton committed Aug 4, 2014
1 parent f42bae8 commit 7350cec
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cargo/ops/cargo_new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ fn mk(path: &Path, name: &str, opts: &NewOptions) -> CargoResult<()> {

if opts.git {
try!(git!("init", path));
try!(File::create(&path.join(".gitignore")).write(b"/target\n"));
let mut gitignore = "/target\n".to_string();
if !opts.bin {
gitignore.push_str("/Cargo.lock\n");
}
try!(File::create(&path.join(".gitignore")).write(gitignore.as_bytes()));
} else {
try!(fs::mkdir(path, io::UserRWX));
}
Expand Down

5 comments on commit 7350cec

@bors
Copy link
Collaborator

@bors bors commented on 7350cec Aug 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from wycats
at alexcrichton@7350cec

@bors
Copy link
Collaborator

@bors bors commented on 7350cec Aug 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging alexcrichton/cargo/issue-304 = 7350cec into auto-cargo

@bors
Copy link
Collaborator

@bors bors commented on 7350cec Aug 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alexcrichton/cargo/issue-304 = 7350cec merged ok, testing candidate = 61a77fd

@bors
Copy link
Collaborator

@bors bors commented on 7350cec Aug 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Collaborator

@bors bors commented on 7350cec Aug 6, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto-cargo = 61a77fd

Please sign in to comment.