diff --git a/src/main.rs b/src/main.rs index 3bd9929..5df6857 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,10 +16,15 @@ fn main() -> anyhow::Result<()> { let path = format!("{}/.git", entry.path().display()); let git_dir = Path::new(&path); if git_dir.exists() { + let repo = Repository::open(git_dir)?; + if repo.is_empty()? { + continue; + } + items.push(format!( "{} = {}", entry.path().to_string_lossy().to_string(), - Repository::open(git_dir)?.head()?.name().unwrap_or("None") + repo.head()?.name().unwrap_or("None") )); } };