Subject: Re: [PATCH] git-send-email.perl: add maildomain_sanitize()

From: Jakub Narebski <[email-masked]>
Date: Thu, 15 Apr 2010 05:47:45 -0700 (PDT)

Jari Aalto <[email-masked]> writes:

> Move duplicate maildomain checks to a single subroutine.
> Require that a FQDN contains at least one period.
> 
> Signed-off-by: Jari Aalto <[email-masked]>
> ---

Good idea.

[...]
> diff --git a/git-send-email.perl b/git-send-email.perl
> index ce569a9..0e8f18c 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -863,14 +863,28 @@ sub sanitize_address
>  # This maildomain*() code is based on ideas in Perl library Test::Reporter
>  # /usr/share/perl5/Test/Reporter/Mail/Util.pm ==> sub _maildomain ()
>  
> +sub maildomain_sanitize
> +{
> +	local $_ = shift;
> +
> +	#  On Mac, the the domain name is not necessarily in FQDN format
> +	#  Require a period in the string
> +
> +	if ( $^O eq 'darwin'  and  /\.local$/ ) {
> +		# Nope, pass this one.
> +	}
> +	elsif ( /\./ ) {
> +		$_;
> +	}
> +}

Style:

  +sub maildomain_sanitize {
  +	local $domain = shift;
  +
  +	#  On Mac, the the domain name is not necessarily in FQDN format
  +	#  Require a period in the string
  +
  +	if ($^O eq 'darwin'  &&  $domain =~ /\.local$/) {
  +		# Nope, pass this one.
  +	} elsif ($domain =~ /\./) {
  +		return $domain;
  +	}
  +}

(probably fixed in new version of this series).
-- 
Jakub Narebski
Poland
ShadeHawk on #git