Fixed repos without a remote having an empty branches list

master
Wynd 2024-09-15 13:42:23 +03:00
parent eaf956ef9f
commit f8b8a69b8c
3 changed files with 9 additions and 4 deletions

2
Cargo.lock generated
View File

@ -426,7 +426,7 @@ dependencies = [
[[package]] [[package]]
name = "git-heatmap" name = "git-heatmap"
version = "1.0.1" version = "1.0.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"chrono", "chrono",

View File

@ -2,7 +2,7 @@ cargo-features = ["codegen-backend"]
[package] [package]
name = "git-heatmap" name = "git-heatmap"
version = "1.0.1" version = "1.0.2"
edition = "2021" edition = "2021"
authors = ["Wynd <wyndftw@proton.me>"] authors = ["Wynd <wyndftw@proton.me>"]
description = "A simple and customizable heatmap for git repos" description = "A simple and customizable heatmap for git repos"

View File

@ -227,8 +227,13 @@ fn get_commits(
let branch_names = &*branches[i]; let branch_names = &*branches[i];
let mut branches = vec![]; let mut branches = vec![];
if branch_names.is_empty() { if branch_names.is_empty() {
if repo.branch_names().is_empty() {
branches.extend(["@"]);
}
else {
branches.extend(repo.branch_names().iter()); branches.extend(repo.branch_names().iter());
} }
}
else { else {
let branch_names = branch_names.split(' '); let branch_names = branch_names.split(' ');
branches.extend(branch_names); branches.extend(branch_names);