|
|
@ -49,7 +49,10 @@ pub struct BoilerplateOpts { |
|
|
|
pub timestamp: Option<stderrlog::Timestamp>,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 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<bool> { |
|
|
|
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);
|
|
|
|