Merge pull request #133 from 9p4/fix-default-branch-detection
Find default branch correctly
Resolves #131
Diff
src/database/indexer.rs | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
@@ -97,7 +97,17 @@
}
fn find_default_branch(repo: &gix::Repository) -> Result<Option<String>, anyhow::Error> {
Ok(Some(repo.head()?.name().as_bstr().to_string()))
if repo.head()?.is_detached() {
Ok(None)
} else {
Ok(Some(
repo.head()?
.referent_name()
.context("HEAD does not point to anything")?
.as_bstr()
.to_string(),
))
}
}
fn find_last_committed_time(repo: &gix::Repository) -> Result<OffsetDateTime, anyhow::Error> {