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) and dfn (file names from the diff) are the most useful ones, lowkey the MVPs πŸ‘‘. Other available values are dfa, dfb, dfctx, dfhh, and dfpre.

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 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