1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
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
|