Re: [PATCH] send-email: address expansion for common mailers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <junkio@xxxxxxx> wrote:
> Eric Wong <normalperson@xxxxxxxx> writes:
> 
> > Two git repo-config keys are required for this
> > (as suggested by Ryan Anderson):
> >
> > 	sendemail.aliasesfile = <filename of aliases file>
> > 	sendemail.aliasfiletype = (mutt|gnus|pine|mailrc)
> >
> > I was initially working on auto-detection, but mailrc and mutt formats
> > tend to throw each other off (they're alike, but handle multiple
> > addresses per-alias differently).
> 
> I think specifying the type explicitly is probably not too much
> hassle for the end user, so that is fine.  Now, do we want to
> support more than one aliases file?

If they're different types, probably not.  But if it's the same type,
it's pretty easy and I don't see why not.  This patch applies on top
of the previous one.

Subject: [PATCH] send-email: allow more than one alias file to be used

The aliasfiletype must be the same for all aliasesfiles, though.

Signed-off-by: Eric Wong <normalperson@xxxxxxxx>

---

 git-send-email.perl |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

16306f761b34505672a04bff333d6342724756c8
diff --git a/git-send-email.perl b/git-send-email.perl
index d3e1768..5d1e95c 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -90,7 +90,7 @@ my ($author) = gitvar_ident('GIT_AUTHOR_
 my ($committer) = gitvar_ident('GIT_COMMITTER_IDENT');
 
 my %aliases;
-chomp(my $aliases_file = `git-repo-config sendemail.aliasesfile`);
+chomp(my @alias_files = `git-repo-config --get-all sendemail.aliasesfile`);
 chomp(my $aliasfiletype = `git-repo-config sendemail.aliasfiletype`);
 my %parse_alias = (
 	# multiline formats can be supported in the future
@@ -116,10 +116,12 @@ my %parse_alias = (
 		}}}
 );
 
-if ($aliases_file && defined $parse_alias{$aliasfiletype}) {
-	open my $fh, '<', $aliases_file or die "opening $aliases_file: $!\n";
-	$parse_alias{$aliasfiletype}->($fh);
-	close $fh;
+if (@alias_files && defined $parse_alias{$aliasfiletype}) {
+	foreach my $file (@alias_files) {
+		open my $fh, '<', $file or die "opening $file: $!\n";
+		$parse_alias{$aliasfiletype}->($fh);
+		close $fh;
+	}
 }
 
 my $prompting = 0;
-- 
1.2.4.gb622a
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]