diff options
author | Eric Wong <e@80x24.org> | 2022-06-20 19:27:29 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-06-21 10:39:10 +0000 |
commit | d0079a334fe2b769e4f81d6bd3c7e4346a8fa2b2 (patch) | |
tree | 952a2f606d24b9a81bb447cbb06f73a16088973e /t | |
parent | 913b8e2f5c3c85eab5d10112c130db44ee2893c3 (diff) | |
download | public-inbox-d0079a334fe2b769e4f81d6bd3c7e4346a8fa2b2.tar.gz |
This allows easy searching via patch-id from a git commit. Currently, abbreviations are not supported, and it seems needless to support them since AFAIK (git) doesn't generate nor resolve abbreviated patch-ids anywhere.
Diffstat (limited to 't')
-rw-r--r-- | t/extsearch.t | 7 | ||||
-rw-r--r-- | t/v2mda.t | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/t/extsearch.t b/t/extsearch.t index 09cbdabe..2d7375d6 100644 --- a/t/extsearch.t +++ b/t/extsearch.t @@ -314,7 +314,12 @@ if ('reindex catches missed messages') { is($new->{subject}, $eml->header('Subject'), 'new message added'); $es->{xdb}->reopen; - my $mset = $es->mset("mid:$new->{mid}"); + # git patch-id --stable <t/data/0001.patch | awk '{print $1}' + my $patchid = '91ee6b761fc7f47cad9f2b09b10489f313eb5b71'; + my $mset = $es->search->mset("patchid:$patchid"); + is($mset->size, 1, 'patchid search works'); + + $mset = $es->mset("mid:$new->{mid}"); is($mset->size, 1, 'previously unseen, now indexed in Xapian'); ok($im->remove($eml), 'remove new message from v2 inbox'); @@ -1,7 +1,8 @@ -# Copyright (C) 2018-2021 all contributors <meta@public-inbox.org> +#!perl -w +# Copyright (C) all contributors <meta@public-inbox.org> # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt> +use v5.10.1; use strict; -use warnings; use Test::More; use Fcntl qw(SEEK_SET); use Cwd; @@ -88,6 +89,11 @@ is($eml->as_string, $mime->as_string, 'injected message'); $pre = $ibx->search->mset_to_smsg($ibx, $pre); $post = $ibx->search->mset_to_smsg($ibx, $post); is($post->[0]->{blob}, $pre->[0]->{blob}, 'same message in both cases'); + + # git patch-id --stable <t/data/0001.patch | awk '{print $1}' + my $patchid = '91ee6b761fc7f47cad9f2b09b10489f313eb5b71'; + my $mset = $ibx->search->mset("patchid:$patchid"); + is($mset->size, 1, 'patchid search works'); } done_testing(); |