From 01f27147baf80e2222927ddca9369c7d99b4ff3c Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Mon, 12 Dec 2022 21:33:09 +0530 Subject: routes: index view --- git/git.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'git') diff --git a/git/git.go b/git/git.go index 1a7ade2..34a25e5 100644 --- a/git/git.go +++ b/git/git.go @@ -52,6 +52,14 @@ func (g *GitRepo) Commits() ([]*object.Commit, error) { return commits, nil } +func (g *GitRepo) LastCommit() (*object.Commit, error) { + c, err := g.r.CommitObject(g.h) + if err != nil { + return nil, fmt.Errorf("last commit: %w", err) + } + return c, nil +} + func (g *GitRepo) FileContent(path string) (string, error) { c, err := g.r.CommitObject(g.h) if err != nil { -- cgit