git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] send-email: Don't use FQDNs without a '.'

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 9, 2010, 05:36 UTC
Message-ID
<7v1vep427o.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1270789906-23735-2-git-send-email-brian@gernhardtsoftware.com>
Brian Gernhardt <brian@gernhardtsoftware.com> writes:
>  		$maildomain = $domain
> -			unless $^O eq 'darwin' && $domain =~ /\.local$/;
> +			unless $^O eq 'darwin' && $domain =~ /\.local$/
> +				or $domain !~ /\./;

It would become *much* easier to read if we stop using the statement modifier, and write it in a more straightforward way:

	unless (($^O eq 'darwin' && $domain =~ /\.local$/)
        	|| $domain !~ /\./) {
                $maildomain = $domain;
	}

as the condition seems to have grown large enough to exceed "by the way don't do this under this narrow condition", which is what statement modifiers are designed to be used. Also mixing && and or that have different precedence taxes readers' brainpower unnecessarily.

I also think that this particular exception logic should probably be in a separate helper function that is called from the two places.

Jari, you are the last person who touched code around this area. What do you think?

Previous: Brian GernhardtNext: Jari Aalto
Message 3 of 12 in “send-email: --smtp-domain improvements”
  1. 0/3 send-email: --smtp-domain improvementsBrian Gernhardt, Apr 9, 2010
  2. 1/3 send-email: Don't use FQDNs without a '.'Brian Gernhardt, Apr 9, 2010
  3. Junio C HamanoApr 9, 2010
  4. git-send-email.perl: Add sub maildomain_sanitizeJari Aalto, Apr 13, 2010
  5. git-send-email.perl: add maildomain_sanitize()Jari Aalto, Apr 13, 2010
  6. Jakub NarebskiApr 15, 2010
  7. git-send-email.perl: Add sub maildomain_sanitizeJari Aalto, Apr 16, 2010
  8. Jakub NarebskiApr 16, 2010
  9. Jari AaltoApr 16, 2010
  10. 2/3 Document send-email --smtp-domainBrian Gernhardt, Apr 9, 2010
  11. 3/3 send-email: Add sendemail.smtpdomainBrian Gernhardt, Apr 9, 2010
  12. Jakub NarebskiApr 9, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.