diff --git a/src/helpers.rs b/src/helpers.rs index f985a9b..cedfd3c 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -49,7 +49,10 @@ pub struct BoilerplateOpts { pub timestamp: Option, } -/// Checks if the given dir contains the root `.git` dir +/// Checks if the given dir contains the root `.git` dir or file +/// +/// Submodules do not contain a complete .git directory, but only a .git file with a reference to +/// the actual folder. This function takes both into account. /// /// # Errors /// @@ -60,13 +63,6 @@ fn has_git_dir(path: &PathBuf) -> Result { git.push(".git"); for entry in path.read_dir().chain_err(|| "Reading contents of dir")? { if let Ok(entry) = entry { - // skip non-directories - if let Ok(ft) = entry.file_type() { - if !ft.is_dir() { - continue; - } - } - // check if this is `.git` if entry.path() == git { return Ok(true);