Undo tag and stage it when git-send-email(1) fails

If there was an error during git-send-email(1) or the user aborted it,
undo the latest tag.  This saves the user from manually running git tag
-d.

Note that we must not lose the cover letter, so stage the latest cover
letter (just like git-publish --edit).  When the user tries again their
latest cover letter will be available.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add invoke_hook() to run githooks(5)

The githooks(5) mechanism makes it easy to customize behavior with user
scripts.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add pre-publish-send-email hook

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add pre-publish-send-email hook example script

This example script file shows how a pre-publish-send-email hook can
validate a patch emails before they are sent.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add Red Hat copyright to git-publish

I have been working for Red Hat since late 2012 and recent changes are
therefore copyright Red Hat.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add --inspect-emails option

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Only undo to staging if there was a cover letter

If this is a patch without a cover letter, don't create a staging tag.
The staging tag would cause an unwanted cover letter to be created when
the user retries.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add git_tag(sign=False) argument

Tag signing is required for pull requests.  Add the new 'sign' argument
to the git_tag() function.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add git_push() wrapper function

Signed tags must be pushed to a remote so the maintainer can fetch and
verify them.  Add the git_push() function.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add --pull-request option

Sending pull requests is a little different from regular patch series.
We need to create a signed tag and push it to the remote.  Then we use
git-request-pull(1) to generate a standard email body.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add documentation on --pull-request

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>