Skip to contentSkip to conversation

git-send-email --suppress-from option doesn't work.

DISCUSSION Timur Tabi 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

The --suppress-from option doesn't work for me because the comparison is too strict.

Here's an example usage of git-send-email:

git-send-email --suppress-from --from [email protected] --to [email protected] --smtp-server remotesmtp.freescale.net 0001-Add-support-for-the-MPC8349E-mITX-GP.txt

I need to specify the --from option, because otherwise git-send-email will prompt me for a From address, and I don't want it to prompt me for anything.

The problem is that the patchfile contains this line:

From: Timur Tabi <[email protected]>

That means that the patchfile contains the string "Timur Tabi <[email protected]>", but the --from specifies the string "[email protected]". The code which checks the suppress-from option is here:

                        } elsif (/^(Cc|From):\s+(.*)$/) {
                                if ($2 eq $from) {
                                        next if ($suppress_from);
                                }

I don't know Perl, but I'm guess the The "$2 eq $from" is a strict comparison that fails in my case.

Some of you might say at this point, "Why don't you just specify --from "Timur Tabi <[email protected]>"? I tried that, and it still doesn't work.

Basically, what I want is to prevent git-send-email from CC'ing me on my own patches. No matter what I do, I can't prevent it from adding "Cc: Timur Tabi <[email protected]>" to the email header.

Signature · 2 lines
Timur Tabi
Linux Kernel Developer @ Freescale
#1 lore raw
Quoted 15 lines · Timur Tabi

The --suppress-from option doesn't work for me because the comparison is too strict.

Here's an example usage of git-send-email:

git-send-email --suppress-from --from [email protected] --to [email protected] --smtp-server remotesmtp.freescale.net 0001-Add-support-for-the-MPC8349E-mITX-GP.txt

I need to specify the --from option, because otherwise git-send-email will prompt me for a From address, and I don't want it to prompt me for anything.

The problem is that the patchfile contains this line:

Quoted 8 lines

From: Timur Tabi <[email protected]>

That means that the patchfile contains the string "Timur Tabi <[email protected]>", but the --from specifies the string "[email protected]". The code which checks the suppress-from option is here:

                        } elsif (/^(Cc|From):\s+(.*)$/) {

I believe

	(/^(Cc|From):[^<]+<([^>])+>.*$/)

would do the trick for your case. It would however fail when specifying a proper --from address in the 'git commit --author="Foo Barson <[email protected]>"' style.

Are you sure you need to specify --from for those patches though?

Quoted 11 lines
                                if ($2 eq $from) {
                                        next if ($suppress_from);
                                }

I don't know Perl, but I'm guess the The "$2 eq $from" is a strict comparison that fails in my case.

Some of you might say at this point, "Why don't you just specify --from "Timur Tabi <[email protected]>"? I tried that, and it still doesn't work.

That sounds extremely odd indeed. Could this have to do with character conversion?

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
author
#2 lore raw
Quoted 7 lines · Andreas Ericsson

I believe

	(/^(Cc|From):[^<]+<([^>])+>.*$/)

would do the trick for your case. It would however fail when specifying a proper --from address in the 'git commit --author="Foo Barson <[email protected]>"' style.

Even so, it would still be very picky about the layout. --suppress-from should just compare the actual email addresses, not the names or any other characters.

Quoted 1 line

Are you sure you need to specify --from for those patches though?

Yes. If I don't specify --from, then git-send-email will prompt me for the From: address. I want git-send-email to be completely non-interactive.

Quoted 6 lines
Quoted 3 lines

Some of you might say at this point, "Why don't you just specify --from "Timur Tabi <[email protected]>"? I tried that, and it still doesn't work.

That sounds extremely odd indeed. Could this have to do with character conversion?

Actually, I figured out the problem is that I can't do this:

FROM='--from "Foo Barson <[email protected]>"'
git-send-email $FROM ...

I got all sorts of weird messages about unbalanced > or something. Instead, I need to do this:

FROM="Foo Barson <[email protected]>"
git-send-email --from $FROM ...

This is probably a shell issue instead of a git-send-email issue, but it is annoying.

Signature · 2 lines
Timur Tabi
Linux Kernel Developer @ Freescale