Skip to content

Commit

Permalink
chore: add .gitignore when initializing git repo (foundry-rs#294)
Browse files Browse the repository at this point in the history
* chore: add .gitignore when initializing git repo

* chore: cargo fmt

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
  • Loading branch information
2 people authored and clifton committed Dec 27, 2021
1 parent ab8109a commit a289bac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assets/.gitignoreTemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cache/
out/
5 changes: 5 additions & 0 deletions cli/src/forge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ fn main() -> eyre::Result<()> {
.spawn()?
.wait()?;
if !is_git.success() {
let gitignore_path = root.join(".gitignore");
std::fs::write(
gitignore_path,
include_str!("../../assets/.gitignoreTemplate"),
)?;
Command::new("git").arg("init").current_dir(&root).spawn()?.wait()?;
Command::new("git").args(&["add", "."]).current_dir(&root).spawn()?.wait()?;
Command::new("git")
Expand Down

0 comments on commit a289bac

Please sign in to comment.