Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
There is a post-commit hook in git, all that's needed is a script that would send an email including the commit diff.
Contents of the README file:
Commit notification e-mail
|
--------------------------
|
|
To configure commit notification e-mails for the first time, do the following:
|
|
- the following should be done regardless commit notification:
|
= install git;
|
= run git config --global user.name "<Your Name>"
|
= run git config --global user.email "<your email>"
|
- clone/pull this tree (further it's location is <this tree>);
|
- create a folder <git templates>;
|
- symlink <this tree>/git_template/hooks to <git templates path>/hooks;
|
- configure git templates location globally:
|
= for git versions >= 1.7.1, run
|
git config --global init.templatedir <git templates path>
|
= for older git versions, set the environmemnt variable
|
GIT_TEMPLATE_DIR=<git templates path>
|
and make sure it is always set whenever you work with git;
|
- run git config --global hooks.postcommitrecipients "<comma-separated list of addresses to send emails to>;
|
- run git config --global hooks.postcommitbranches "<space-separated list of branches> (* wildcard is allowed)
|
- optionally:
|
= run git config --global hooks.postcommitsender <e-mail to send notifications from>
|
= run git config --global hooks.postcommitmailer <path to mailer>
|
if anything other than /usr/sbin/sendmail is to be used
|
- make sure <this tree>/git_template/hooks/post-commit-email is executable;
|
|
Example (most common set of commands):
|
|
bzr branch lp:mariadb-tools
|
mkdir $HOME/.git_template/
|
ln -s `pwd`/mariadb-tools/git_template/hooks $HOME/.git_template/hooks
|
git config --global init.templatedir $HOME/.git_template
|
git config --global hooks.postcommitrecipients "commits@mariadb.org"
|
git config --global hooks.postcommitbranches "*"
|
|
From now on, for all new clones of branches listed in hooks/postcommitbranches,
|
commit notifications should be sent.
|
|
If you had already cloned some trees before enabling commit notifications,
|
you will need to amend those trees:
|
|
cd <cloned folder>
|
rm -rf .git/hooks
|
ln -s <this tree>/git_template/hooks .git/hooks
|
|
|
To disable commit notification(s), set SKIP_COMMIT_EMAIL environment variable
|
to a non-empty value or set hooks.postcommitbranches to an empty value.
|
|
|
Notes:
|
|
- hooks/postcommitrecipients is a *comma-separated* list of e-mails. Normally,
|
it is expected to contain the commit mailing list, but you can add some other
|
address(es) or change it if you wish;
|
- hooks/postcommitbranches is a *space-separated* list of branches affected
|
by the post-commit hook. Asterisk wildcard is allowed.
|
Please note that these are *real* git branches, as opposed to branch nicknames.
|
|
Examples:
|
|
Assuming you did the following
|
git clone https://github.com/MariaDB/server 10.1-mdev1234
|
...
|
git branch
|
# * 10.1
|
git commit -a
|
|
Example 1:
|
postcommitbranches = 10.0 10.1 10.2
|
# The commit e-mail will be sent because the current branch is 10.1,
|
# it's on the list
|
|
Example 2:
|
postcommitbranches = 10.0-* 10.1-* 10.2-*
|
# The commit e-mail won't be sent because the current branch is 10.1,
|
# it does not match the pattern 10.1-*
|
|
Example 3:
|
postcommitbranches = 10*
|
# The commit e-mail will be sent
|
|
Attachments
Issue Links
- relates to
-
MDEV-5240 Create 10.1 on github
-
- Closed
-
Activity
Description |
There is a post-commit hook in git, all that's needed is a script that would send an email *including the commit diff*. |
There is a post-commit hook in git, all that's needed is a script that would send an email *including the commit diff*. Contents of the README file: {noformat} Commit notification e-mail -------------------------- To configure commit notification e-mails, do the following: - install git; - clone this tree; - (optionally) copy or symlink git_template folder to some <git templates path>; - configure git templates location globally: = for git versions >= 1.7.1, run git config --global init.templatedir <git templates path> = for older git versions, set the environmemnt variable GIT_TEMPLATE_DIR=<git templates path> and make sure it is always set whenever you work with git; - make sure that <git templates path>/hooks/post-commit is executable; - (optionally) edit <git templates path>/config file: = check that hooks/postcommitrecipients has the desired value; = check that hooks/postcommitbranches has the desired value; = set hooks/postcommitsender to the e-mail that you want notifications to be sent from; = configure postcommitmailer if necessary; From now on, for all branches listed in hooks/postcommitbranches, commit notifications should be sent. To disable commit notifications, set SKIP_COMMIT_EMAIL environment variable to a non-empty value. Notes: - hooks/postcommitrecipients is a *comma-separated* list of e-mails. Normally, it is expected to contain the commit mailing list, but you can add some other address(es) or change it if you wish; - hooks/postcommitbranches is a *space-separated* list of branches affected by the post-commit hook. Asterisk wildcard is allowed. Please note that these are *real* git branches, as opposed to branch nicknames. Examples: Assuming you did the following git clone https://github.com/MariaDB/server 10.1-mdev1234 ... git branch # * 10.1 git commit -a Example 1: postcommitbranches = 10.0 10.1 10.2 # The commit e-mail will be sent because the current branch is 10.1, # it's on the list Example 2: postcommitbranches = 10.0-* 10.1-* 10.2-* # The commit e-mail won't be sent because the current branch is 10.1, # it does not match the pattern 10.1-* Example 3: postcommitbranches = 10* # The commit e-mail will be sent {noformat} |
Assignee | Elena Stepanova [ elenst ] | Kristian Nielsen [ knielsen ] |
Assignee | Kristian Nielsen [ knielsen ] | Elena Stepanova [ elenst ] |
Description |
There is a post-commit hook in git, all that's needed is a script that would send an email *including the commit diff*. Contents of the README file: {noformat} Commit notification e-mail -------------------------- To configure commit notification e-mails, do the following: - install git; - clone this tree; - (optionally) copy or symlink git_template folder to some <git templates path>; - configure git templates location globally: = for git versions >= 1.7.1, run git config --global init.templatedir <git templates path> = for older git versions, set the environmemnt variable GIT_TEMPLATE_DIR=<git templates path> and make sure it is always set whenever you work with git; - make sure that <git templates path>/hooks/post-commit is executable; - (optionally) edit <git templates path>/config file: = check that hooks/postcommitrecipients has the desired value; = check that hooks/postcommitbranches has the desired value; = set hooks/postcommitsender to the e-mail that you want notifications to be sent from; = configure postcommitmailer if necessary; From now on, for all branches listed in hooks/postcommitbranches, commit notifications should be sent. To disable commit notifications, set SKIP_COMMIT_EMAIL environment variable to a non-empty value. Notes: - hooks/postcommitrecipients is a *comma-separated* list of e-mails. Normally, it is expected to contain the commit mailing list, but you can add some other address(es) or change it if you wish; - hooks/postcommitbranches is a *space-separated* list of branches affected by the post-commit hook. Asterisk wildcard is allowed. Please note that these are *real* git branches, as opposed to branch nicknames. Examples: Assuming you did the following git clone https://github.com/MariaDB/server 10.1-mdev1234 ... git branch # * 10.1 git commit -a Example 1: postcommitbranches = 10.0 10.1 10.2 # The commit e-mail will be sent because the current branch is 10.1, # it's on the list Example 2: postcommitbranches = 10.0-* 10.1-* 10.2-* # The commit e-mail won't be sent because the current branch is 10.1, # it does not match the pattern 10.1-* Example 3: postcommitbranches = 10* # The commit e-mail will be sent {noformat} |
There is a post-commit hook in git, all that's needed is a script that would send an email *including the commit diff*. Contents of the README file: {noformat} Commit notification e-mail -------------------------- To configure commit notification e-mails, do the following: - install git; - clone this tree; - (optionally) copy or symlink git_template folder to some <git templates path>; - configure git templates location globally: = for git versions >= 1.7.1, run git config --global init.templatedir <git templates path> = for older git versions, set the environmemnt variable GIT_TEMPLATE_DIR=<git templates path> and make sure it is always set whenever you work with git; - make sure that <git templates path>/hooks/post-commit is executable; - (optionally) edit <git templates path>/config file: = check that hooks/postcommitrecipients has the desired value; = check that hooks/postcommitbranches has the desired value; = set hooks/postcommitsender to the e-mail that you want notifications to be sent from; = configure postcommitmailer if necessary; From now on, for all new clones of branches listed in hooks/postcommitbranches, commit notifications should be sent. If you had already cloned some trees before enabling commit notifications, you will need to amend those trees: - add the hook script to the tree by either running: = cd <cloned folder> git init = or cp <git templates path>/hooks/post-commit <cloned folder>/.git/hooks/ - copy hooks/postcommit* options from <git templates path>/config to <cloned folder>/.git/config To disable commit notification(s), set SKIP_COMMIT_EMAIL environment variable to a non-empty value. Notes: - hooks/postcommitrecipients is a *comma-separated* list of e-mails. Normally, it is expected to contain the commit mailing list, but you can add some other address(es) or change it if you wish; - hooks/postcommitbranches is a *space-separated* list of branches affected by the post-commit hook. Asterisk wildcard is allowed. Please note that these are *real* git branches, as opposed to branch nicknames. Examples: Assuming you did the following git clone https://github.com/MariaDB/server 10.1-mdev1234 ... git branch # * 10.1 git commit -a Example 1: postcommitbranches = 10.0 10.1 10.2 # The commit e-mail will be sent because the current branch is 10.1, # it's on the list Example 2: postcommitbranches = 10.0-* 10.1-* 10.2-* # The commit e-mail won't be sent because the current branch is 10.1, # it does not match the pattern 10.1-* Example 3: postcommitbranches = 10* # The commit e-mail will be sent {noformat} |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] | |
Status | Closed [ 6 ] | Reopened [ 4 ] |
Description |
There is a post-commit hook in git, all that's needed is a script that would send an email *including the commit diff*. Contents of the README file: {noformat} Commit notification e-mail -------------------------- To configure commit notification e-mails, do the following: - install git; - clone this tree; - (optionally) copy or symlink git_template folder to some <git templates path>; - configure git templates location globally: = for git versions >= 1.7.1, run git config --global init.templatedir <git templates path> = for older git versions, set the environmemnt variable GIT_TEMPLATE_DIR=<git templates path> and make sure it is always set whenever you work with git; - make sure that <git templates path>/hooks/post-commit is executable; - (optionally) edit <git templates path>/config file: = check that hooks/postcommitrecipients has the desired value; = check that hooks/postcommitbranches has the desired value; = set hooks/postcommitsender to the e-mail that you want notifications to be sent from; = configure postcommitmailer if necessary; From now on, for all new clones of branches listed in hooks/postcommitbranches, commit notifications should be sent. If you had already cloned some trees before enabling commit notifications, you will need to amend those trees: - add the hook script to the tree by either running: = cd <cloned folder> git init = or cp <git templates path>/hooks/post-commit <cloned folder>/.git/hooks/ - copy hooks/postcommit* options from <git templates path>/config to <cloned folder>/.git/config To disable commit notification(s), set SKIP_COMMIT_EMAIL environment variable to a non-empty value. Notes: - hooks/postcommitrecipients is a *comma-separated* list of e-mails. Normally, it is expected to contain the commit mailing list, but you can add some other address(es) or change it if you wish; - hooks/postcommitbranches is a *space-separated* list of branches affected by the post-commit hook. Asterisk wildcard is allowed. Please note that these are *real* git branches, as opposed to branch nicknames. Examples: Assuming you did the following git clone https://github.com/MariaDB/server 10.1-mdev1234 ... git branch # * 10.1 git commit -a Example 1: postcommitbranches = 10.0 10.1 10.2 # The commit e-mail will be sent because the current branch is 10.1, # it's on the list Example 2: postcommitbranches = 10.0-* 10.1-* 10.2-* # The commit e-mail won't be sent because the current branch is 10.1, # it does not match the pattern 10.1-* Example 3: postcommitbranches = 10* # The commit e-mail will be sent {noformat} |
There is a post-commit hook in git, all that's needed is a script that would send an email *including the commit diff*. Contents of the README file: {noformat} Commit notification e-mail -------------------------- To configure commit notification e-mails for the first time, do the following: - the following should be done regardless commit notification: = install git; = run git config --global user.name "<Your Name>" = run git config --global user.email "<your email>" - clone/pull this tree (further it's location is <this tree>); - create a folder <git templates>; - symlink <this tree>/git_template/hooks to <git templates path>/hooks; - configure git templates location globally: = for git versions >= 1.7.1, run git config --global init.templatedir <git templates path> = for older git versions, set the environmemnt variable GIT_TEMPLATE_DIR=<git templates path> and make sure it is always set whenever you work with git; - run git config --global hooks.postcommitrecipients "<comma-separated list of addresses to send emails to>; - run git config --global hooks.postcommitbranches "<space-separated list of branches> (* wildcard is allowed) - optionally: = run git config --global hooks.postcommitsender <e-mail to send notifications from> = run git config --global hooks.postcommitmailer <path to mailer> if anything other than /usr/sbin/sendmail is to be used - make sure <this tree>/git_template/hooks/post-commit-email is executable; Example (most common set of commands): bzr branch lp:mariadb-tools mkdir $HOME/.git_template/ ln -s `pwd`/mariadb-tools/git_template/hooks $HOME/.git_template/hooks git config --global init.templatedir $HOME/.git_template git config --global hooks.postcommitrecipients "commits@mariadb.org" git config --global hooks.postcommitbranches "*" From now on, for all new clones of branches listed in hooks/postcommitbranches, commit notifications should be sent. If you had already cloned some trees before enabling commit notifications, you will need to amend those trees: cd <cloned folder> rm -rf .git/hooks ln -s <this tree>/git_template/hooks .git/hooks To disable commit notification(s), set SKIP_COMMIT_EMAIL environment variable to a non-empty value or set hooks.postcommitbranches to an empty value. Notes: - hooks/postcommitrecipients is a *comma-separated* list of e-mails. Normally, it is expected to contain the commit mailing list, but you can add some other address(es) or change it if you wish; - hooks/postcommitbranches is a *space-separated* list of branches affected by the post-commit hook. Asterisk wildcard is allowed. Please note that these are *real* git branches, as opposed to branch nicknames. Examples: Assuming you did the following git clone https://github.com/MariaDB/server 10.1-mdev1234 ... git branch # * 10.1 git commit -a Example 1: postcommitbranches = 10.0 10.1 10.2 # The commit e-mail will be sent because the current branch is 10.1, # it's on the list Example 2: postcommitbranches = 10.0-* 10.1-* 10.2-* # The commit e-mail won't be sent because the current branch is 10.1, # it does not match the pattern 10.1-* Example 3: postcommitbranches = 10* # The commit e-mail will be sent {noformat} |
Workflow | defaullt [ 41601 ] | MariaDB v2 [ 44083 ] |
Status | Reopened [ 4 ] | Stalled [ 10000 ] |
Component/s | OTHER [ 10125 ] | |
Fix Version/s | N/A [ 14700 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Workflow | MariaDB v2 [ 44083 ] | MariaDB v3 [ 65228 ] |
Workflow | MariaDB v3 [ 65228 ] | MariaDB v4 [ 132345 ] |
Hi Kristian,
Could you please do a quick review?
The commit email was sent to the list, otherwise the code can be found here:
https://github.com/elenst/mariadb-toolbox/tree/master/git_template