On Sun, Nov 11, 2012 at 6:12 PM, Ramkumar Ramachandra
<artag...@gmail.com> wrote:
> Felipe Contreras wrote:
>> I got really tired of 'git send-email' always asking me from which address 
>> to send mails... that's already configured.
> Use sendemail.from.  The email sender doesn't necessarily have to be the 
> author.

And when it's not the author, then sendemail.from would be used.

% git config user.email felipe.contre...@nokia.com
% git send-email master
From: Felipe Contreras <felipe.contre...@nokia.com>

% git config user.email felipe.contre...@gmail.com
% git send-email.perl master
From: Felipe Contreras <felipe.contre...@gmail.com>

% git send-email --from=f...@bar.com master
From: f...@bar.com

% git config sendemail.from t...@example.com
% git send-email master
From: t...@example.com

What do you loose with this code? Nothing. What do you gain by asking
the user every time: "Who should the emails appear to be from?", when
the default GIT_AUTHOR_IDENT is already fine? Nothing.

The problem with sendemail.from, is that each time the user needs to
change email address, it has to be done in multiple places:
user.email, and sendemail.from. There's no need for that.

But I screwed the patch, it should be:

+if (!defined $sender) {
+       my $name = Git::config('user.name');
+       my $email = Git::config('user.email');
+       if (defined $email) {
+               if (defined $name) {
+                       $sender = sprintf("%s <%s>", $name, $email);
+               } else {
+                       $sender = $email;
+               }
+       }


Felipe Contreras
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to