3

Our team uses the Ruby gem hitch to manage pairing. You set it up with a group email address (e.g. dev@mycompany.com) and then tell it who is pairing:

$ hitch james tiffany

Hitch then sets your Git author configuration so that our commits look like

commit 629dbd4739eaa91a720dd432c7a8e6e1a511cb2d
Author: James and Tiffany <dev+james+tiffany@mycompany.com>
Date:   Thu Oct 31 13:59:05 2013 -0700

Unfortunately, we've only been able to come up with two options:

  1. dev@mycompany.com doesn't exist. The downside is that if Travis CI tries to notify us that we broke the build, we don't see it.
  2. Dev@mycompany.com does exist and forwards to all the developers. Now the downside is that everyone gets spammed with every broken build by every pair.

We have too many possible pair to do any of the following:

  1. set up actual pair-james-tiffany@mycompany.com email addresses or groups (n^2 email addresses)
  2. set up forwarding rules for dev+james+tiffany@mycompany.com (n^2 forwarding rules)
  3. set up forwarding rules for james+tiffany@mycompany.com (n forwarding rules for each of n developers)

Does anyone have a system that works for them?

EDIT

I obviously missed a very important piece: we use GMail Business for all our company mail. We can add and remove users and groups, and users can create filters, but we don't have control over the MTA itself.

  • 1
    Can't your mail thingy do an "intelligent" processing of the email address? Doesn't sound to outlandish to do the redirects with a single rule (even if it calls out to an external script or something). – Mat Nov 2 '13 at 5:56
  • 1
    I'd simply set up a few inbox processing rules to trash any mail addressed to dev+ but without my name in the to, so that only mails to dev+ that also includes james+ in the "to" mail account remain in my inbox. Something that should easily be done by all developers. Most mail servers allow for these kinds of rules server side as well so you can set up the distribution centrally on the server. – Marjan Venema Nov 2 '13 at 11:21
  • @Mat Our mail "thingy" is GMail. Neither the user admin nor the mailbox filters has support for regex filtering. I can match on an exact to: address, but there are too many of those. – James A. Rosen Nov 4 '13 at 17:26
  • You can process mail using IMAP, right? In other words, having an IMAP connection to help you with rules. It doesn't stop the mail from coming in, but it can trash those that you don't want, or move them to a 'review' label for gmail. Someone probably already mentioned the procmail and other tools though. – vgoff Dec 16 '13 at 2:40
3

The plus symbol has a special meaning in most email servers. While it is part of the address, it generally doesn't affect who receives the message. So dev+persona+personb@domain.com goes to dev@domain.com. This is true for Gmail for Business as well.

Gmail's filters aren't as sophisticated as those in, say, procmail, or even, as far as I can tell, Outlook. But if you get dev@domain.com set up, all the messages for those pairs will go through there. But you can write a filter that searches, for example, for to:yourname and tag it with a special label.

Because of that, and because Google limits how many rules you can have that forward email, I'd probably just start by setting dev up as an alias or a mailing list, and make sure everyone gets those emails. Advise each team member to set up a filter that looks like "to:dev to:theirname" and capture it in a way that will get their attention (Apply a label, star it or whatever works for them).

If you need something more sophisticated than what Gmail offers, such as only forwarding the relevant messages to the right developer, you'll need dev@whatever.com to be a real account. You can then use a tool like Sift, perhaps on a lightweight Amazon instance or on an underutilized machine sitting in a closet somewhere, to process the messages and forward them as needed.

Another alternative is to recognize that there are two fields of relevant information stored on each commit: the author and the committer. Author and Committer are automatically the same under typical circumstances where multiple people have commit rights. However, in workflows where one person pulls a change from someone else and commits it to the core repo, the author and committer may be different. You can force this to happen using either of two mechanisms, explained on A tour of Git:

If you specify a --author option to the “git commit” command on the command line, followed by a "Real Name " string, then this name and addresss will be used for the author fields. The committer fields will still be determined as below. This option is very helpful for when applying a commit originally authored by someone other than yourself.

If any of the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, or GIT_COMMITER_EMAIL environment variables are set, then those values will be used for the corresponding fields

If you have a file in your home directory called .gitconfig, with name or email settings in the [user] section, then these values will be used to set any remaining author and committer fields. For more details on the contents of this file, refer to section 2.7.1 below.

If you have a file in the local repository called .git/config, again with name or email settings in the [user] section, then these values will be used to set any remaining author and committer fields.

If you have set the EMAIL environment variable, this will be used to set author and committer email addresses if still unset. git will query your system to find out your real name from available GECOS field and your username, hostname, and domain to construct an email address, (or at least an identifier resembling an email address).

In a pairing context, which one is the author and which is the committer is an arbitrary decision, but the fact is that the distinction opens the door to documenting both people involved in any particular commit.

A reasonably savvy continuous integration or build system could leverage both fields to send notifications to two separate people, which I think would work nicely for pairing situations. I don't know whether yours would, having no direct experience with it, but it is probably worth an experiment or perhaps a dive into documentation to find out.

1

Many sufficiently advanced mail processing applications (I'm looking at procmail at the moment, though I'm certain this can also be done with outlook email rules too) have the ability to do custom rules. Or it could be as simple as using a .forward file with |program as the contents.

The approach is essentially set up dev as an account, but set up a program to receive and then resend email.

When the system sees the comment part of the email address of "+alice+bob" it would then split out the names, and then forward the mail appropriately to alice@company.com and bob@company.com.

Depending on the company and how tightly bound the mail server is to the IT department, Postfix or exim: Automated/Programmatic and forwarded email setup on ServerFault touches on using postfix to do the appropriate rules, or write some procmail rules, or outlook rules, or a program that takes the mail message and resends it to the appropriate people.


Noting the Ruby the following two bits may be of use in implementing the last part of the solution:

Also look at WebApps.StackExchange gmail and gmail-filters tags for the possibility of adding the appropriate filters in gmail itself.

  • I like this idea. We couldn't actually have our server do it (since we don't control the GMail servers), but we could set up a bot as the recipient who forwards the mail to the proper folks. – James A. Rosen Nov 4 '13 at 17:34
  • @JamesA.Rosen that last option would be the most appropriate in your situation then. A program that downloads the mail (IMAP), marks it read, and then forwards the mail message (see Net::IMAP for fetching the mail and How to send email via smtp with Ruby's mail gem? for sending it) – user40980 Nov 4 '13 at 17:53
0

Email to user+param - passing param to scripts (Unix/Linux)

Your MTA may deliver dev+james+tiffany@mycompany.com via procmail (~dev/.procmailrc) with james+tiffany in $1.

~/dev/procmailrc may execute any program/script you like with $1 (james+tiffany as parameter) after some sanity checks.

AFAIK On most linuxes with sendmail as MTA and installed procmail all you need only to configure procmail (~dev/.procmailrc).

Do you use Linux/Unix mail server? Which MTA do you use? (sendmail/postfix/exim/...) Have you installed procmail?

  • We use GMail. We don't have that much control over the handling. – James A. Rosen Nov 4 '13 at 17:27
  • Do you get single recipient address in Delivered-To: header? – AnFi Nov 4 '13 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.