From f8b8a69b8c475a8a08a34619d1d34bbfb1781631 Mon Sep 17 00:00:00 2001 From: Wynd Date: Sun, 15 Sep 2024 13:42:23 +0300 Subject: [PATCH] Fixed repos without a remote having an empty branches list --- Cargo.lock | 2 +- Cargo.toml | 4 ++-- src/main.rs | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8cea0f1..15124f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -426,7 +426,7 @@ dependencies = [ [[package]] name = "git-heatmap" -version = "1.0.1" +version = "1.0.2" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 9fb8bb4..d4dbc75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ cargo-features = ["codegen-backend"] [package] name = "git-heatmap" -version = "1.0.1" +version = "1.0.2" edition = "2021" authors = ["Wynd "] description = "A simple and customizable heatmap for git repos" @@ -31,4 +31,4 @@ incremental = true opt-level = 3 strip = true lto = true -codegen-units = 1 +codegen-units = 1 \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 70a7786..c0f3862 100644 --- a/src/main.rs +++ b/src/main.rs @@ -227,7 +227,12 @@ fn get_commits( let branch_names = &*branches[i]; let mut branches = vec![]; if branch_names.is_empty() { - branches.extend(repo.branch_names().iter()); + if repo.branch_names().is_empty() { + branches.extend(["@"]); + } + else { + branches.extend(repo.branch_names().iter()); + } } else { let branch_names = branch_names.split(' ');