Allow sending emails only for a subset of refs

Many projects use a pull-request model with a central repository, where
new changes are pushed to branches named e.g. feature/whizbang.  However,
users really don't view these branches as "part of the repository" until
they are merged into a 'real' branch, such as master.  And lots of users
are very annoyed at getting email notifications for pushes to these
branches; they only want to be notified when some subset of branches are
updated.

There's a slight complication, though: traditionally git-multimail has
only sent out commit emails for commits that are entirely new to the
repository, but this doesn't play well with this filtering feature.  So,
we need to instead have git-multimail only send out commit emails for
commits that are entirely new to the *relevant subset of the* repository.

Add multimailhook.refFilterInclusionRegex and
multimailhook.refFilterExclusionRegex configuration options, with related
--ref-filter-inclusion-regex and --ref-filter-exclusion-regex command
line options, which can be used to configure which refs are considered
relevant.  Mark ^refs/notes/ as irrelevant by default as git-multimail
emails make no sense for git notes.

Signed-off-by: Elijah Newren <newren@palantir.com>
testing: Pass additional arguments through test functions to multimail

Signed-off-by: Elijah Newren <newren@palantir.com>
Test restricting emails to a subset of refs defined by exclusion

Signed-off-by: Elijah Newren <newren@palantir.com>
Test restricting emails to a subset of refs defined by inclusion

Signed-off-by: Elijah Newren <newren@palantir.com>
StashEnvironment: New environment for being called from Atlassian Stash

Atlassian Stash can utilize a standard post-receive hook, and thus we
could use git_multimail as-is.  However, that is slightly suboptimal
because: (a) when pull requests are merged in stash, they are done on the
server and thus the normal post-receive hook is not triggered, (b)
everything runs as a single user similar to gitolite, but without a
GL_USER environment variable to rely on, and (c) although stash has
reasonable clone urls that having meaningful names for repositories, the
actual on-disk directories in which the repositories are stored are given
positive integers for names -- that results in a rather meaningless email
subject for the users ("[2093] branch master updated..." rather than
"[PROJ/REPO] branch master updated..."), since they will have no idea what
magic integer happened to be selected for their repository.

We can avoid these problems by making use of Stash's
AsyncPostReceiveRepositoryHook instead of a standard post-receive hook,
since it is triggered in all the right cases and has access to the
appropriate user and repo name.  Add a StashEnvironment for holding this
passed information, and add command line flags that can be passed with
the user and repo name.

Signed-off-by: Elijah Newren <newren@palantir.com>