Skip to content

Commit

Permalink
fix: Default mappings were not inherited and did not include .gitignore
Browse files Browse the repository at this point in the history
This fixes #67
  • Loading branch information
chasinglogic committed Oct 21, 2024
1 parent 855bb7c commit c36838a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/profiles/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,20 @@ impl From<Vec<Mapping>> for Mapper {

impl From<Option<Vec<Mapping>>> for Mapper {
fn from(mappings: Option<Vec<Mapping>>) -> Mapper {
let configured: Vec<Mapping> = match mappings {
let mut configured: Vec<Mapping> = match mappings {
Some(configured) => configured,
None => vec![Mapping::skip("README.*"), Mapping::skip("LICENSE")],
None => vec![],
};

let default_mappings = vec![
Mapping::skip("README.*"),
Mapping::skip("LICENSE"),
Mapping::skip(".gitignore"),
Mapping::skip(".git"),
Mapping::skip(".dfm.yml"),
];
configured.extend(default_mappings);

Mapper::from(configured)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/profiles/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type GitResult = Result<ExitStatus, io::Error>;
fn is_dotfile(entry: &DirEntry) -> bool {
let filename = entry.file_name().to_str().unwrap_or("");
// .git files and .dfm.yml are not dotfiles so should be ignored.
let is_sys_file = filename == ".dfm.yml" || filename == ".git" || filename == "README.md";
let is_sys_file = filename == ".dfm.yml" || filename == ".git";
!is_sys_file
}

Expand Down

0 comments on commit c36838a

Please sign in to comment.