Our team uses the Ruby gem hitch to manage pairing. You set it up with a group email address (e.g. [email protected]
) 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 <[email protected]>
Date: Thu Oct 31 13:59:05 2013 -0700
Unfortunately, we’ve only been able to come up with two options:
[email protected]
doesn’t exist. The downside is that if Travis CI tries to notify us that we broke the build, we don’t see it.[email protected]
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:
- set up actual
[email protected]
email addresses or groups (n^2 email addresses) - set up forwarding rules for
[email protected]
(n^2 forwarding rules) - set up forwarding rules for
[email protected]
(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.
4
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 [email protected] goes to [email protected]. 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 [email protected] 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 [email protected] 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 fieldsIf 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.
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 [email protected] and [email protected].
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:
- Net::IMAP
- How to send email via smtp with Ruby’s mail gem?
Also look at WebApps.StackExchange gmail and gmail-filters tags for the possibility of adding the appropriate filters in gmail itself.
2
Email to user+param – passing param to scripts (Unix/Linux)
Your MTA may deliver [email protected]
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?
2