From cb50649d855e9999391bf596d40c4a53974bc01a Mon Sep 17 00:00:00 2001 From: Wynd Date: Sun, 15 Sep 2024 14:05:59 +0300 Subject: [PATCH] Fixed a potential error due to local repos not having any branches --- src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index c0f3862..a14fffd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -243,8 +243,14 @@ fn get_commits( let mut has_commits = false; for branch in branches { - let branch_commits = repo - .rev_parse(branch)? + // When passing the default @ (HEAD) branch this might actually not exist at all + // locally so we're skipping it + let Ok(rev) = repo.rev_parse(branch) + else { + continue; + }; + + let branch_commits = rev .single() .unwrap() .ancestors()