🏡 index : ~doyle/rgit.git

author jordan <jordan@doyle.la> 2025-04-08 0:52:57.0 +07:00:00
committer GitHub <noreply@github.com> 2025-04-08 0:52:57.0 +07:00:00
commit
551253a049d8d02e704b3e43f19109c973a4d2e1 [patch]
tree
19778855e38198068e65ea5f14c7eb39237450a3
parent
a500c79e9cbd32007d31af5013c7be18f74701dd
parent
5a4ef3501823b924d94e96784d78d307b248df53
download
551253a049d8d02e704b3e43f19109c973a4d2e1.tar.gz

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(-)

diff --git a/src/database/indexer.rs b/src/database/indexer.rs
index 72cf47b..7311c32 100644
--- a/src/database/indexer.rs
+++ a/src/database/indexer.rs
@@ -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> {