From d55a352b7ee8f240b2e24e13b4dc90b6ba3d2c6f Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Wed, 25 Jan 2023 00:16:40 -0800 Subject: [PATCH] fix frequency for repo with only one commit --- bin/gitfetch/gitfetch.go | 8 ++++---- gico.go | 12 +++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bin/gitfetch/gitfetch.go b/bin/gitfetch/gitfetch.go index 1f5c974..fa9e0c5 100644 --- a/bin/gitfetch/gitfetch.go +++ b/bin/gitfetch/gitfetch.go @@ -7,15 +7,16 @@ import ( git "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing/object" - "github.com/taigrr/gico" gterm "github.com/taigrr/gitgraph/term" + + "github.com/taigrr/gico" ) func main() { GetYear() } -func GetYear() { +func GetYear() { r, err := git.PlainOpenWithOptions(".", &(git.PlainOpenOptions{DetectDotGit: true})) if err != nil { fmt.Printf("gitfetch error: Could not find a git repository to open!\n") @@ -56,6 +57,5 @@ func GetYear() { freq[k.YearDay()-1]++ } } - gterm.GetYearUnicode(freq[:]) - + gterm.GetYearUnicode(freq) } diff --git a/gico.go b/gico.go index 1d8ac13..1f858e5 100644 --- a/gico.go +++ b/gico.go @@ -1,4 +1,4 @@ -package gico +package main import ( "flag" @@ -61,20 +61,22 @@ type WorkDay struct { } func NewCommit(Author, Message, Repo, Path string, LOC int) Commit { - ci := Commit{Message: Message, - Author: Author, LOC: LOC, TimeStamp: time.Now(), - Repo: Repo, Path: Path} + ci := Commit{ + Message: Message, + Author: Author, LOC: LOC, TimeStamp: time.Now(), + Repo: Repo, Path: Path, + } return ci } func loadRepo() { - } func readCommitDB() DataSet { ds := DataSet{} return ds } + func printHelp() { fmt.Println("help:") }