aboutsummaryrefslogtreecommitdiff
path: root/contrib/hooks
Commit message (Collapse)AuthorAge
* git-multimail: update to version 1.0.0Michael Haggerty2014-04-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains the squashed changes from the upstream git-multimail repository since the last code drop. Highlights: * Fix encoding of non-ASCII email addresses in email headers. * Fix backwards-compatibility bugs for older Python 2.x versions. * Fix a backwards-compatibility bug for Git 1.7.1. * Add an option commitDiffOpts to customize logs for revisions. * Pass "-oi" to sendmail by default to prevent premature termination on a line containing only ".". * Stagger email "Date:" values in an attempt to help mail clients thread the emails in the right order. * If a mailing list setting is missing, just skip sending the corresponding email (with a warning) instead of failing. * Add a X-Git-Host header that can be used for email filtering. * Allow the sender's fully-qualified domain name to be configured. * Minor documentation improvements. * Add a CHANGES file. Contributions-by: Raphaël Hertzog <hertzog@debian.org> Contributions-by: Eric Berberich <eric.berberich@gmail.com> Contributions-by: Michiel Holtkamp <git@elfstone.nl> Contributions-by: Malte Swart <mswart@devtation.de> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* mark contributed hooks executableJonathan Nieder2013-11-25
| | | | | | | | | | | | | | | | | | | | | The docs in contrib/hooks/pre-auto-gc-battery suggest: For example, if the hook is stored in /usr/share/git-core/contrib/hooks/pre-auto-gc-battery: chmod a+x pre-auto-gc-battery cd /path/to/your/repository.git ln -sf /usr/share/git-core/contrib/hooks/pre-auto-gc-battery \ hooks/pre-auto-gc Unfortunately on multi-user systems most users do not have write access to /usr. Better to mark the sample hooks executable in the first place so users do not have to tweak their permissions to use them by symlinking into .git/hooks/. Reported-by: Olivier Berger <olivier.berger@it-sudparis.eu> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* hooks/post-receive-email: set declared encoding to utf-8Gerrit Pape2013-08-05
| | | | | | | | | | | | | | | | Some email clients (e.g., claws-mail) display the message body incorrectly when the charset is not defined explicitly in a Content-Type header. "git log" generates logs in UTF-8 encoding by default, so add a Content-Type header declaring that encoding to the emails the post-receive-email example hook sends. [jn: also setting the Content-Transfer-Encoding so MTAs know what kind of mangling might be needed when sending to a non 8-bit clean SMTP host] Requested-by: Alexander Gerasiov <gq@debian.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* hooks/post-receive-email: force log messages in UTF-8Jonathan Nieder2013-08-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | Git commands write commit messages in UTF-8 by default, but that default can be overridden by the [i18n] commitEncoding and logOutputEncoding settings. With such a setting, the emails written by the post-receive-email hook use a mixture of encodings: 1. Log messages use the configured log output encoding, which is meant to be whatever encoding works best with local terminals (and does not have much to do with what encoding should be used for email) 2. Filenames are left as is: on Linux, usually UTF-8, and in the Mingw port (which uses Unicode filesystem APIs), always UTF-8 3. The "This is an automated email" preface uses a project description from .git/description, which is typically in UTF-8 to support gitweb. So (1) is configurable, and (2) and (3) are unconfigurable and typically UTF-8. Override the log output encoding to always use UTF-8 when writing the email to get the best chance of a comprehensible single-encoding email. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* hooks/post-receive-email: use plumbing instead of git log/showJonathan Nieder2013-08-05
| | | | | | | | | | | | | | This way the hook doesn't have to keep being tweaked as porcelain learns new features like color and pagination. While at it, replace the "git rev-list | git shortlog" idiom with plain "git shortlog" for simplicity. Except for depending less on the value of settings like '[log] abbrevCommit', no change in output intended. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* post-receive-email: deprecate script in favor of git-multimailMichael Haggerty2013-07-22
| | | | | | | | | Add a notice to the top of post-receive-email explaining that the script is no longer under active development and pointing the user to git-multimail. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-multimail: an improved replacement for post-receive-emailMichael Haggerty2013-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add git-multimail, a tool for generating notification emails for pushes to a Git repository. It is largely plug-in compatible with post-receive-email, and is proposed to eventually replace that script. The advantages of git-multimail relative to post-receive-email are described in README.migrate-from-post-receive-email. git-multimail is organized in a directory contrib/hooks/multimail. The directory contains: * git_multimail.py -- a Python module that can generate notification emails for pushes to a Git repository. The file can be used directly as a post-receive script (configured via git config settings), or it can be imported as a Python module and configured via arbitrary Python code. * README -- user-level documentation for configuring and using git-multimail. * post-receive -- an example of building a post-receive script that imports git_multimail.py as a Python module, with an example of how to change the email templates. * README.migrate-from-post-receive-email -- documentation targeted at current users of post-receive-email, explaining the differences and how to migrate a post-receive-email configuration to git-multimail. * migrate-mailhook-config -- a script that can migrate a user's post-receive-email configuration options to the equivalent git-multimail options. * README.Git -- a short explanation of the relationship between git-multimail and the rest of the Git project, plus the exact date and revision when this version was taken from the upstream project. All but the last file are taken verbatim from the upstream git-multimail project. git-multimail is originally derived from post-receive-email and also incorporates suggestions from the mailing list as well as patches by the people listed below. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Contributions-by: Matthieu Moy <Matthieu.Moy@imag.fr> Contributions-by: Ramkumar Ramachandra <artagnon@gmail.com> Contributions-by: Chris Hiestand <chrishiestand@gmail.com> Contributions-by: Michiel Holtkamp <git@elfstone.nl> Contributions-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/hooks/setgitperms.perl: use a lowercase "usage:" stringDavid Aguilar2013-02-24
| | | | | | | | Make the usage string consistent with Git. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add Auto-Submitted header to post-receive-emailChris Hiestand2013-01-17
| | | | | | | | | This conforms to RFC3834 and is useful in preventing eg vacation auto-responders from replying by default Signed-off-by: Chris Hiestand <chiestand@salk.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix spelling error in post-receive-email hookRichard Fearn2012-10-13
| | | | | Signed-off-by: Richard Fearn <richardfearn@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* post-receive-email: match up $LOGBEGIN..$LOGEND pairs correctlyMichael Haggerty2012-02-27
| | | | | Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* post-receive-email: remove unused variableMichael Haggerty2012-02-27
| | | | | | | prep_for_email neither is passed a fourth argument nor uses it. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/hooks: adapt comment about Debian install location for contrib hooksGerrit Pape2011-09-26
| | | | | | | | | | | | Placing the contrib hooks into /usr/share/doc/ wasn't a good idea in the first place. According to the Debian policy they should be located in /usr/share/git-core/, so let's put them there. Thanks to Bill Allombert for reporting this through http://bugs.debian.org/640949 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add option hooks.diffopts to customize change summary in post-receive-emailJon Jensen2011-08-04
| | | | | | | | | | | | This makes it easy to customize the git diff-tree options, for example to include -p to include inline diffs. It defaults to the current options "--stat --summary --find-copies-harder" and thus is backward-compatible. Signed-off-by: Jon Jensen <jon@endpoint.com> Improved-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* post-receive-email: suppress error if description file missingSitaram Chamarty2011-02-07
| | | | | Signed-off-by: Sitaram Chamarty <sitaramc@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/hooks/post-receive-email: fix return values from prep_for_emailAlan Raison2010-12-09
| | | | | | | | | | The function was returning 0 for failure and 1 for success which was breaking the logic in the main loop. It now also returns in all cases, rather than exiting. Signed-off-by: Alan Raison <alan@theraisons.me.uk> Acked-by: Kevin P. Fleming <kpfleming@digium.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'kf/post-receive-sample-hook' into maintJunio C Hamano2010-11-24
|\ | | | | | | | | * kf/post-receive-sample-hook: post-receive-email: ensure sent messages are not empty
| * post-receive-email: ensure sent messages are not emptyKevin P. Fleming2010-09-10
| | | | | | | | | | | | | | | | | | | | | | | | Changes the logic in the script to determine whether an email message will be sent before invoking the send_mail() function; otherwise, if the logic determines that a message will not be sent, send_mail() will cause an empty email to be sent. In addition, ensures that if multiple refs are updated and a message cannot be sent for one of them, the others are still processed normally. Signed-off-by: Kevin P. Fleming <kpfleming@digium.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'kf/post-receive-sample-hook'Junio C Hamano2010-08-18
|\ \ | |/ | | | | | | * kf/post-receive-sample-hook: post-receive-email: optional message line count limit
| * post-receive-email: optional message line count limitKevin P. Fleming2010-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have become used to the features of svnmailer when used with Subversion, and one of those useful features is that it can limit the maximum length (in lines) of a commit email message. This is terribly useful since once the goes beyond a reasonable number of lines, nobody is going to read the remainder, and if they really want the entire contents of the commits, they can use git itself to get them using the revision IDs present in the message already. Change the post-receive-email script to respond to an 'emailmaxlines' config key which, if specified, will limit the number of lines generated (including headers); any lines beyond the limit are suppressed, and a final line is added indicating the number that were suppressed. Signed-off-by: Kevin P. Fleming <kpfleming@digium.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | post-receive-email: remove spurious commas in email subjectMatthieu Moy2010-08-11
|/ | | | | | | | | | | | | The previous form produced subjects like [SCM] project.git branch, foo, updated. ... The new one will produce the lighter [SCM] project.git branch foo updated. ... Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* post-receive-email: document command-line modeJonathan Nieder2010-05-19
| | | | | | | | | | | | | | | | | | | | | According to the default hooks/post-receive file, the hook is called with three arguments on stdin: <oldrev> <newrev> <refname> In command-line mode, the arguments come in a different order, because the email hook instead calls: generate_email $2 $3 $1 Add a comment to explain why, based on comments from the mailing list and the commit message to v1.5.1~9. Thanks to Andy for the explanation. Requested-by: martin f. krafft <madduck@debian.org> Cc: Andy Parkins <andyparkins@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Use 'fast-forward' all over the placeFelipe Contreras2009-10-24
| | | | | | | It's a compound word. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* post-receive-email: hooks.showrev: show how to include both web link and patchJim Meyering2009-05-23
| | | | | | | | | | | | | | | | | | Add a comment showing how to include a web link (i.e. gitweb/cgit) and a patch in the email that is sent for each pushed commit. The quoting was tricky enough that it's worth documenting. To add two blank lines (i.e. put \n\n in the printf), you would need to say \\\\n\\\\n, and in the end, the pair of "echo" statements seemed better. This is used in glibc.git repository: http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=summary push-triggered messages have been sent to this list since May 21: http://sourceware.org/ml/glibc-cvs/2009-q2/ Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix contrib/hooks/post-receive-email for new duplicate branchPat Notz2009-02-11
| | | | | | | | | | | | | | | | | | | In the show_new_revisions function, the original code: git rev-parse --not --branches | grep -v $(git rev-parse $refname) | isn't quite right since one can create a new branch and push it without any new commits. In that case, two refs will have the same sha1 but both would get filtered by the 'grep'. In the end, we'll show ALL the history which is not what we want. Instead, we should list the branches by name and remove the branch being updated and THEN pass that list through rev-parse. Revised as suggested by Jakub Narebski and Junio C Hamano to use git-for-each-ref instead of git-branch. (Thanks!) Signed-off-by: Pat Notz <pknotz@sandia.gov> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/hooks/post-receive-email: Make revision display configurablePete Harlan2008-11-04
| | | | | | | | Add configuration option hooks.showrev, letting the user override how revisions will be shown in the commit email. Signed-off-by: Pete Harlan <pgit@pcharlan.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/hooks/post-receive-email: Put rev display in separate functionPete Harlan2008-11-04
| | | | | | | | | The display of a revision in an email-appropriate format is done in two places with similar code. In preparation for making that display more complex, move it into a separate function that handles both cases. Signed-off-by: Pete Harlan <pgit@pcharlan.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add Linux PPC support to the pre-auto-gc example hookMiklos Vajna2008-10-14
| | | | | Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add OS X support to the pre-auto-gc example hookJonathan del Strother2008-09-30
| | | | | | Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv> Acked-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Use dashless git commands in setgitperms.perlTodd Zullinger2008-09-22
| | | | | Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Ignore no-op changes in paranoid update hookShawn O. Pearce2008-05-25
| | | | | | | | | If the hook gets invoked with identical old and new ids there is no change taking place. We probably should not have been called, but instead of failing silently allow the no-op. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Don't load missing ACL files in paranoid update hookShawn O. Pearce2008-05-25
| | | | | | | | | | | If a user or group ACL file does not exist in the current tip revision of the acl repository we will get an error from cat-file when we ask for that blob as it cannot be resolved. A quick look at the history by rev-list can tell us if there is a path there or not. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Don't diff empty tree on branch creation in paranoid update hookShawn O. Pearce2008-05-25
| | | | | | | | | | | | Listing all files in a branch during branch creation is silly; the user's file-level ACLs probably don't mean anything at this point. We now treat the base case of 0{40} as an empty diff, as this happens only when the user is creating the branch and there are file level ACLs that diff against the old value of the branch. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint'Junio C Hamano2008-04-22
|\ | | | | | | | | | | | | | | | | * maint: post-receive-email: fix accidental removal of a trailing space in signature line Escape project names before creating pathinfo URLs Escape project name in regexp bash: Add completion for git diff --base --ours --theirs diff-options.txt: document the new "--dirstat" option
| * post-receive-email: fix accidental removal of a trailing space in signature lineAndy Parkins2008-04-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | post-receive-email adds a signature to the end of emails in generate_email_footer(). The signature was separated from the main email body using the standard string "-- ". (see RFC 3676) a6080a0 (War on whitespace, 2007-06-07) removed the trailing whitespace from "-- ", leaving it as "--", which is not a correct signature separator. This patch restores the missing space, but does it in a way that will not set off the trailing whitespace alarms. Signed-off-by: Andy Parkins <andyparkins@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | contrib/hooks: add an example pre-auto-gc hookMiklos Vajna2008-04-09
|/ | | | | | | | It disables git-gc --auto when you are running Linux and you are not on AC. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* specify explicit "--pretty=medium" with `git log/show/whatchanged`Denis Cheng2008-03-05
| | | | | | | | | | | The following patch will introduce a new configuration variable, "format.pretty", from then on the pretty format without specifying "--pretty" might not be the default "--pretty=medium", it depends on the user's config. So all kinds of Shell/Perl/Emacs scripts that needs the default medium pretty format must specify it explicitly. Signed-off-by: Denis Cheng <crquan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Remove usage of git- (dash) commands from email hookDan McGee2008-01-13
| | | | | | | | Switch all git command calls to use the git (space) command format, and remove the use of git-repo-config in place of git config. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/hooks/post-receive-email: remove cruft, $committer is not usedGerrit Pape2007-11-08
| | | | | Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/hooks/post-receive-email: make subject prefix configurableGerrit Pape2007-11-07
| | | | | | | | | | | Email subjects are prefixed with "[SCM] " by default, make this optionally configurable through the hooks.emailprefix config option. Suggested by martin f krafft through http://bugs.debian.org/428418 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/hooks/post-receive-email: reformat to wrap comments at 76 charsGerrit Pape2007-11-07
| | | | | Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/hooks/post-receive-email: fix typoGerrit Pape2007-11-07
| | | | | Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint'Shawn O. Pearce2007-10-18
|\ | | | | | | | | | | | | | | | | * maint: Yet more 1.5.3.5 fixes mentioned in release notes cvsserver: Use exit 1 instead of die when req_Root fails. git-blame shouldn't crash if run in an unmerged tree git-config: print error message if the config file cannot be read fixing output of non-fast-forward output of post-receive-email
| * fixing output of non-fast-forward output of post-receive-emailRobert Schiele2007-10-18
| | | | | | | | | | | | | | | | | | | | | | post-receive-email has one place where the variable fast_forward is not spelled correctly. At the same place the logic was reversed. The combination of both bugs made the script work correctly for fast-forward commits but not for non-fast-forward ones. This change fixes this to be correct in both cases. Signed-off-by: Robert Schiele <rschiele@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Minor usage update in setgitperms.perlJosh England2007-10-15
| | | | | | | | | | | | Signed-off-by: Josh England <jjengla@sandia.gov> Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | fix contrib/hooks/post-receive-email hooks.recipients error messageJeff Muizelaar2007-10-15
| | | | | | | | | | | | | | | | Have the error message for missing recipients actually report the missing config variable and not a fictional one. Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge branch 'maint'Junio C Hamano2007-10-01
|\ \ | |/ | | | | | | | | | | * maint: Whip post 1.5.3.3 maintenance series into shape. git stash: document apply's --index switch post-receive-hook: Remove the From field from the generated email header so that the pusher's name is used
| * post-receive-hook: Remove the From field from the generated email header so ↵Andy Parkins2007-10-01
| | | | | | | | | | | | | | | | | | | | | | | | | | that the pusher's name is used Using the name of the committer of the revision at the tip of the updated ref is not sensible. That information is available in the email itself should it be wanted, and by supplying a "From", we were effectively hiding the person who performed the push - which is useful information in itself. Signed-off-by: Andy Parkins <andyparkins@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'maint'Junio C Hamano2007-09-25
|\ \ | |/ | | | | | | | | | | * maint: Do not over-quote the -f envelopesender value. unexpected Make output (e.g. from --debug) causes build failure Fixed minor typo in t/t9001-send-email.sh test command line.
| * Do not over-quote the -f envelopesender value.Jim Meyering2007-09-25
| | | | | | | | | | | | | | | | | | | | | | | | Without this, the value passed to sendmail would have an extra set of single quotes. At least exim's sendmail emulation would object to that: exim: bad -f address "'list-addr@example.org'": malformed address: ' \ may not follow 'list-addr@example.org error: hooks/post-receive exited with error code 1 Signed-off-by: Jim Meyering <jim@meyering.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>