aboutsummaryrefslogtreecommitdiffstats
path: root/lib/pama/find.go
blob: 72203ee6aeaa9389a660e1bb13817e08ef916384 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package pama

import (
	"fmt"

	"git.sr.ht/~rjarry/aerc/lib/pama/models"
)

func (m PatchManager) Find(hash string, p models.Project) (models.Commit, error) {
	var c models.Commit
	rc, err := m.rc(p.RevctrlID, p.Root)
	if err != nil {
		return c, revErr(err)
	}
	if !rc.Exists(hash) {
		return c, fmt.Errorf("no commit found for hash %s", hash)
	}
	return models.NewCommit(rc, hash, ""), nil
}