LEI-P2Q(1)
π LEI-P2Q(1) β the public-inbox user manual, but make it cute β¨
okay so bestie, you're reading the lei-p2q page from the public-inbox user manual, and honestly? it's a little gem. let's get into it π«Ά
πΈ NAME πΈ
lei-p2q β use a patch to generate a lei-q query. that's it, that's the whole vibe. it takes a patch and hands you back a query. iconic behavior fr fr.
β¨ SYNOPSIS β¨
lei p2q [OPTIONS] (FILE|COMMIT)
lei p2q [OPTIONS] (--stdin|-)
π¦ DESCRIPTION π¦
So here's the tea β: give it a patch, and it creates a query that you can feed on stdin to lei-q(1). Why would you even want that? because it's literally the way to map a patch to the associated messages of an inbox. like, matching up patch β messages. chef's kiss π
The patch can come from stdin or from a file. OR β and this is the fun part β if you give it an argument that does not point to an existing file, it gets taken as a reference to a commit in the current git repository, and git-format-patch(1) is used to generate the patch for you. no cap, it just does that. π
π OPTIONS π
-w PREFIX[,PREFIX],--want=PREFIX[,PREFIX]β the search prefixes to use.dfpost(post-image git blob ID) anddfn(file names from the diff) are the most useful ones, lowkey the MVPs π. Other available values aredfa,dfb,dfctx,dfhh, anddfpre.
Appending an integer to dfpost or dfpre indicates a minimum ID length, and the generated query will be for that value up through the default abbreviation length. Example time, because this one needs it π if the repository's core.abbrev is set to auto and git calculates the default abbreviation length as 7, then dfpost6 will expand a post-image blob ID of e7b4b32 (seven characters) into dfpost:e7b4b32 OR dfpost:e7b4b3. slay, it just grows outward like that β¨
This option may be given multiple times. (yes bestie, stack 'em up π§)
Default: dfpost7
--stdinβ read the message from stdin. This is implicit if no arguments are given and stdin is a pipe or regular file. so like, it kinda already knows. main character energy tbh π--debugβ dumps output that shows the information collected for every prefix. This information can be useful for seeing how a patch is processed, but the format should not be considered stable. β οΈ read that again: not stable. don't go parsing it in a script and then acting surprised, i'm begging π--uriβ URI escape the output, for interacting with HTTP(S) public-inbox instances. perfect for when you're linking things in the group chat π-q,--quietβ suppress feedback messages. for when you want peace and quiet. mood honestly π
π₯ EXAMPLES π₯
# to search for all threads which touch a given thread:
lei p2q $COMMIT_OID | lei q -t -o /tmp/results
# to view results on a remote HTTP(S) public-inbox instance
$BROWSER https://example.com/pub-inbox/?q=$(lei p2q --uri $COMMIT_OID)
# to view unapplied patches for a given $FILE from the past year:
echo \( rt:last.year.. AND dfn:$FILE \) AND NOT \( \
$(git log -p --pretty=mboxrd --since=last.year $FILE |
lei p2q -F mboxrd )
\) | lei q -o /tmp/unapplied
the third one is giving big-brain energy ngl, an entire pipeline in a echo π§ β¨
π¬ CONTACT π¬
Feedback welcome via plain-text mail to <mailto:meta@public-inbox.org> β they genuinely want to hear from you, bestie π«Ά
The mail archives are hosted at <https://public-inbox.org/meta/> and <http://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/meta/>
π COPYRIGHT π
Copyright all contributors <mailto:meta@public-inbox.org>
License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
π SEE ALSO π
lei-q(1)β the one this whole page exists to feed. go read it next, i'll wait π
aaaand that's the whole page, no thoughts just facts π this was brought to you by public-inbox.git, dated 1993-10-02 β yes that date is real, don't @ me, and that's the cute little sign-off πβ¨
π¦ where this page comes from
- arch rolling: lei 2.1.0-2 Β· AGPL
- nixos 26.05: perl5.42.3-public-inbox 2.1.0
- nixpkgs unstable: perl5.42.3-public-inbox 2.1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms