Skip to content

Commit

Permalink
Add .gitignore entries to ignore binary files
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Mar 22, 2024
1 parent d83749c commit 0a367d5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ impl Compiler {
);
fs::write(build.join("Cargo.toml"), cargo_config.trim_start())?;

let gitignore = root.as_ref().join(".gitignore");
if let Ok(mut ignored) = fs::read_to_string(&gitignore) {
if !ignored.ends_with("\n") {
ignored.push_str("\n");
}

if !ignored.lines().any(|line| line == "target") {
ignored.push_str("target\n");
}

if !ignored.lines().any(|line| line == ".icebergs") {
ignored.push_str(".icebergs\n");
}

fs::write(gitignore, ignored)?;
}

let hash = {
use std::hash::{DefaultHasher, Hash, Hasher};

Expand Down

0 comments on commit 0a367d5

Please sign in to comment.