From 5f2236489fa734612595b9100548d96db1e4e67a Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Mon, 18 Sep 2023 12:59:17 -0400 Subject: [PATCH] address PR review feedback Signed-off-by: Alex Goodman --- chronicle/release/releasers/github/summarizer_test.go | 1 - internal/git/first.go | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/chronicle/release/releasers/github/summarizer_test.go b/chronicle/release/releasers/github/summarizer_test.go index 3016e58..d3ed970 100644 --- a/chronicle/release/releasers/github/summarizer_test.go +++ b/chronicle/release/releasers/github/summarizer_test.go @@ -1451,7 +1451,6 @@ func gitTagCommit(t *testing.T, path, tag string) string { func gitHeadCommit(t *testing.T, path string) string { t.Helper() - // why the ~1? we want git log to return inclusive results cmd := exec.Command("git", "--no-pager", "rev-parse", "HEAD") cmd.Dir = path output, err := cmd.Output() diff --git a/internal/git/first.go b/internal/git/first.go index f214d48..6b3d1fa 100644 --- a/internal/git/first.go +++ b/internal/git/first.go @@ -12,11 +12,14 @@ func FirstCommit(repoPath string) (string, error) { if err != nil { return "", fmt.Errorf("unable to open repo: %w", err) } + iter, err := r.Log(&git.LogOptions{}) if err != nil { return "", fmt.Errorf("unable to log commits: %w", err) } + // the iterator works just like "git log", which is in reverse chronological order. That means the + // first commit in the repo is the last item in the iterator. var last string err = iter.ForEach(func(c *object.Commit) error { if c != nil {