aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2023-11-24 16:03:11 +0100
committerRobin Jarry <robin@jarry.cc>2023-12-30 15:42:09 +0100
commit6f8f3d718c8b0303d16d9bfae2770a031678df59 (patch)
tree8211c92e944f3f6a53750cbcd930682f664e0f9b /lib
parentf8c9e7fff564667700c3dbc239d55db8fcd032a6 (diff)
downloadaerc-6f8f3d718c8b0303d16d9bfae2770a031678df59.tar.gz
patch/find: add find sub-cmd
Implement the :patch find command. Search and filter for a given commit by subject line in the current accout and current folder. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib')
-rw-r--r--lib/pama/find.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/pama/find.go b/lib/pama/find.go
new file mode 100644
index 00000000..72203ee6
--- /dev/null
+++ b/lib/pama/find.go
@@ -0,0 +1,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
+}