Linux maintainer tooling and workflows
 help / color / Atom feed
* [b4] make 'b4 mbox' reorder headers so piping to 'git imap-send' works
@ 2020-12-21  0:21 Philippe Blain
  2020-12-21 17:03 ` Konstantin Ryabitsev
       [not found] ` <1652CA1A4BC02C6D.17984@linux.kernel.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Philippe Blain @ 2020-12-21  0:21 UTC (permalink / raw)
  To: tools; +Cc: konstantin

Hi,

I'm using 'b4 mbox -o- <url> | git imap-send' to quickly import
threads to my email account when I see an interesting thread that
I'd like to reply to (I contribute to Git but I'm not subscribed to the
Git mailing list).

This only works if the emails in the threads have the 'From', 'Date'
and 'Subject' headers in exactly that order, because that order is
hard-coded in 'git imap-send' [1]. I wrote a small script [2] that
just reads the headers and reorders them accordingly but I'd like to
just use 'b4 mbox' instead as it has more features. However I discovered
that such reordering is not done by b4. For example, this fails as 'git imap-send'
reports 'nothing to send':

b4 mbox -o- https://lore.kernel.org/git/op.0vvmwohypvqxoc@damia/T/#u | git imap-send

It would be nice if b4 would take care of the reordering.

Cheers,

Philippe.

[1] https://git-scm.com/docs/git-imap-send#_description
[2] https://gist.github.com/phil-blain/d350e91959efa6e7afce60e74bf7e4a8

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [b4] make 'b4 mbox' reorder headers so piping to 'git imap-send' works
  2020-12-21  0:21 [b4] make 'b4 mbox' reorder headers so piping to 'git imap-send' works Philippe Blain
@ 2020-12-21 17:03 ` Konstantin Ryabitsev
       [not found] ` <1652CA1A4BC02C6D.17984@linux.kernel.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Ryabitsev @ 2020-12-21 17:03 UTC (permalink / raw)
  To: Philippe Blain; +Cc: tools

On Sun, Dec 20, 2020 at 07:21:43PM -0500, Philippe Blain wrote:
> Hi,
> 
> I'm using 'b4 mbox -o- <url> | git imap-send' to quickly import
> threads to my email account when I see an interesting thread that
> I'd like to reply to (I contribute to Git but I'm not subscribed to the
> Git mailing list).
> 
> This only works if the emails in the threads have the 'From', 'Date'
> and 'Subject' headers in exactly that order, because that order is
> hard-coded in 'git imap-send' [1]. I wrote a small script [2] that
> just reads the headers and reorders them accordingly but I'd like to
> just use 'b4 mbox' instead as it has more features. However I discovered
> that such reordering is not done by b4. For example, this fails as 'git imap-send'
> reports 'nothing to send':
> 
> b4 mbox -o- https://lore.kernel.org/git/op.0vvmwohypvqxoc@damia/T/#u | git imap-send
> 
> It would be nice if b4 would take care of the reordering.

I'm not sure that's a great solution, as you may be hitting other weird
corner-cases with git-imap-send. I suggest using isync/mbsync for this
purpose. I just added a tweak to b4 mbox that will recognize when -o receives
a maildir, in which case instead of saving an .mbox file, it will add messages
to the maildir instead, e.g.:

  b4 mbox -o ~/Mail [msgid]

This will add all messages from the retrieved thread to the mail spool in
~/Mail (assuming it has the expected {new,cur,tmp} subdirs).

Regards,
-K

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [tools] [b4] make 'b4 mbox' reorder headers so piping to 'git imap-send' works
       [not found] ` <1652CA1A4BC02C6D.17984@linux.kernel.org>
@ 2020-12-21 19:03   ` Konstantin Ryabitsev
  0 siblings, 0 replies; 3+ messages in thread
From: Konstantin Ryabitsev @ 2020-12-21 19:03 UTC (permalink / raw)
  To: tools; +Cc: Philippe Blain

On Mon, Dec 21, 2020 at 12:03:47PM -0500, Konstantin Ryabitsev via linux.kernel.org wrote:
>   b4 mbox -o ~/Mail [msgid]
> 
> This will add all messages from the retrieved thread to the mail spool in
> ~/Mail (assuming it has the expected {new,cur,tmp} subdirs).

I just added a -f|--filter-dupes flag to "b4 mbox" that will check the
existing maildir for existing duplicates before adding messages from the
retrieved thread. This allows neat things like retrieving the rest of the
thread directly from mutt. If you add the following to .muttrc:

macro index 4 "<pipe-message>~/bin/b4.sh mbox -f -o ~/Mail<return>"

(obviously, use something other than ~/Mail if it's not where your maildir is)

This lets you hit "4" in the index view to retrieve the rest of the thread for
the message that is currently selected (or tagged). Handy for when you're cc'd
in the middle of a discussion and want to grab everything else for context.

NOTE: -f requires iterating through the entire maildir to collect existing
msgids, so it's not recommended for huge maildirs.

-K

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21  0:21 [b4] make 'b4 mbox' reorder headers so piping to 'git imap-send' works Philippe Blain
2020-12-21 17:03 ` Konstantin Ryabitsev
     [not found] ` <1652CA1A4BC02C6D.17984@linux.kernel.org>
2020-12-21 19:03   ` [tools] " Konstantin Ryabitsev

Linux maintainer tooling and workflows

Archives are clonable:
	git clone --mirror https://lore.kernel.org/tools/0 tools/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 tools tools/ https://lore.kernel.org/tools \
		tools@linux.kernel.org
	public-inbox-index tools

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.linux.tools


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git