From ec642ccefcea99c775d30c41b42eca42b9f4eccf Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Fri, 17 Feb 2023 17:47:37 -0800 Subject: [PATCH] fix getAuthor/Email funcs --- cmd/cli/cli.go | 14 ++++++++++---- commits/chancommits.go | 4 ++-- commits/common.go | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/cmd/cli/cli.go b/cmd/cli/cli.go index 721d795..87c42c3 100644 --- a/cmd/cli/cli.go +++ b/cmd/cli/cli.go @@ -9,6 +9,7 @@ import ( "github.com/charmbracelet/bubbles/key" tea "github.com/charmbracelet/bubbletea" "github.com/charmbracelet/lipgloss" + "github.com/taigrr/gico/commits" "github.com/taigrr/gico/types" ) @@ -185,15 +186,20 @@ func NewCommitLog() (CommitLog, error) { now := time.Now() today := now.YearDay() - 1 year := now.Year() - aName, _ := commits.GetAuthorName() - aEmail, _ := commits.GetAuthorEmail() - authors := []string{aName, aEmail} + aName, err := commits.GetAuthorName() + if err != nil { + return m, err + } + aEmail, err := commits.GetAuthorEmail() + if err != nil { + return m, err + } mr, err := commits.GetMRRepos() if err != nil { return m, err } + m.Authors = []string{aName, aEmail} m.Repos = mr - m.Authors = authors m.Year = year m.Selected = today m.Commits, err = mr.GetRepoCommits(m.Year, m.Authors) diff --git a/commits/chancommits.go b/commits/chancommits.go index 6e01234..2311b71 100644 --- a/commits/chancommits.go +++ b/commits/chancommits.go @@ -39,11 +39,11 @@ func (paths RepoSet) GetRepoCommits(year int, authors []string) ([][]types.Commi return } cc = FilterCChanByYear(cc, year) - cc, err = FilterCChanByAuthor(cc, authors) + cc2, err := FilterCChanByAuthor(cc, authors) if err != nil { return } - for c := range cc { + for c := range cc2 { outChan <- c } }(p) diff --git a/commits/common.go b/commits/common.go index 374df5b..f17d860 100644 --- a/commits/common.go +++ b/commits/common.go @@ -50,7 +50,7 @@ func GetAuthorName() (string, error) { if err != nil { return "", err } - return conf.Author.Name, nil + return conf.User.Name, nil } func GetAuthorEmail() (string, error) { @@ -58,5 +58,5 @@ func GetAuthorEmail() (string, error) { if err != nil { return "", err } - return conf.Author.Email, nil + return conf.User.Email, nil }