about summary refs log tree commit homepage
path: root/lib/PublicInbox/Inbox.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/Inbox.pm')
-rw-r--r--lib/PublicInbox/Inbox.pm12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index c982d0b4..faab03ce 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -7,6 +7,7 @@ use strict;
 use warnings;
 use Scalar::Util qw(weaken);
 use PublicInbox::Git;
+use PublicInbox::MID qw(mid2path);
 
 sub new {
         my ($class, $opts) = @_;
@@ -90,4 +91,15 @@ sub nntp_usable {
         $ret;
 }
 
+sub msg_by_path ($$;$) {
+        my ($self, $path, $ref) = @_;
+        # TODO: allow other refs:
+        git($self)->cat_file('HEAD:'.$path, $ref);
+}
+
+sub msg_by_mid ($$;$) {
+        my ($self, $mid, $ref) = @_;
+        msg_by_path($self, mid2path($mid), $ref);
+}
+
 1;