Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
git:generic-settings [2009/01/16 04:07] janakj |
git:generic-settings [2010/01/12 22:02] (current) linulin no spam |
||
---|---|---|---|
Line 4: | Line 4: | ||
===== Mail Notifications ===== | ===== Mail Notifications ===== | ||
- | The central git repository can send email notifications whenever a contributor | + | The central git repository can send email notifications whenever a |
- | pushes commits into it. The mailing script is in $GIT_REPO/ | + | contributor |
- | is called from $GIT_REPO/ | + | $GIT_REPO/ |
- | from the repository. To enable mail notifications you have to set | + | notifications can be configured from the repository. To enable mail |
- | mailNotifications to true in the hooks section: | + | notifications you have to set mailNotifications to true in the hooks |
+ | section: | ||
- | <code> | + | <code> |
[hooks] | [hooks] | ||
mailNotification = true | mailNotification = true | ||
- | </code> | + | </code> |
- | After that you need to configure the sender and recipient email addresses and | + | After that you need to configure the sender and recipient email |
- | a link to gitweb. These parameters belong to section mail: | + | addresses and a link to gitweb. These parameters belong to section |
+ | mail: | ||
- | <code> | + | <code> |
[mail] | [mail] | ||
envelopeSender = admin@sip-router.org | envelopeSender = admin@sip-router.org | ||
recipient = admin@sip-router.org | recipient = admin@sip-router.org | ||
gitwebURL = http:// | gitwebURL = http:// | ||
- | </code> | + | </code> |
- | Parameter '' | + | Parameter '' |
- | message envelope. This is the email address that will receive delivery status | + | in the message envelope. This is the email address that will receive |
- | notification and notifications of failures. This is not the email address that | + | delivery status notification and notifications of failures. This is |
- | will be put in From header, the From header will be set to your name and email | + | not the email address that will be put in From header, the From header |
- | address which you configured in git and which appears in the commits. | + | will be set to your name and email address which you configured in git |
+ | and which appears in the commits. | ||
- | Parameter '' | + | Parameter '' |
- | mailing list. Mail notifications can contain a link to gitweb in the body, | + | development |
- | configure '' | + | gitweb in the body, configure '' |
- | to gitweb in your email notifications. | + | gitweb if you want to have a link to gitweb in your email |
+ | notifications. | ||
- | The mapping of usernames to email addresses is done using a static file. The | + | The mapping of usernames to email addresses is done using a static |
- | original commitlog script used a static address in From. I then modified the | + | file. The original commitlog script used a static address in From. I |
- | script to extract the author information from the commit object so that we can | + | then modified the script to extract the author information from the |
- | use it in From and people can reply to commitlog messages directly -- reaching | + | commit object so that we can use it in From and people can reply to |
- | the author of the change. Unfortunately this did not work as I expected. A | + | commitlog messages directly -- reaching the author of the |
- | contributor might pull some changes from a private repository for somebody | + | change. Unfortunately this did not work as I expected. A contributor |
- | else and then the email address of that person would be in the author field | + | might pull some changes from a private repository for somebody else |
- | and in From header of the commitlog, although the commit was done by somebody | + | and then the email address of that person would be in the author field |
- | else. Then we tried to use the committer field from the commit object, but the | + | and in From header of the commitlog, although the commit was done by |
- | result was the same, most of the time it contains the same email address as | + | somebody |
- | the author field. | + | commit object, but the result was the same, most of the time it |
+ | contains the same email address as the author field. | ||
- | It turned out that we couldn' | + | It turned out that we couldn' |
- | environment variables in people' | + | GIT_COMMITTER_EMAIL |
- | because git executes the shell as non-interactive and non-login so the startup | + | either to be used in From, because git executes the shell as |
- | files are ignored when git executes commands and hooks on the server. | + | non-interactive and non-login so the startup files are ignored when |
+ | git executes commands and hooks on the server. | ||
So I ended up adding a simple mapping file, it is in $GIT_DIR/ | So I ended up adding a simple mapping file, it is in $GIT_DIR/ | ||
- | format is & | + | format is |
+ | < | ||
+ | username=First Last <email> | ||
+ | </ | ||
You can define a catch-all rule in the mapping file which will be used | You can define a catch-all rule in the mapping file which will be used | ||
- | whenever no matching username can be find if you replace the username with *: | + | whenever no matching username can be find if you replace the username |
+ | with *: | ||
- | <code> | + | <code> |
*=root@localhost | *=root@localhost | ||
- | </cod> | + | </code> |
- | and I added a new configuration option to the git config where you can specify with mapping file will be used for the repository: | + | and I added a new configuration option to the git config where you can |
+ | specify with mapping file will be used for the repository: | ||
- | & | + | <code> |
[mail] | [mail] | ||
envelopeSender = email_addr | envelopeSender = email_addr | ||
Line 72: | Line 83: | ||
gitwebURL = http:// | gitwebURL = http:// | ||
emailMap = $GIT_DIR/ | emailMap = $GIT_DIR/ | ||
- | & | + | </code> |
- | The mailing script dies if it cannot translate a username to email address. It is also possible specify a static From address in the git confiuration file, i.e: | + | The mailing script dies if it cannot translate a username to email |
+ | address. It is also possible specify a static From address in the git | ||
+ | confiuration file, i.e: | ||
- | & | + | <code> |
[mail] | [mail] | ||
from=admin@sip-router.org | from=admin@sip-router.org | ||
- | & | + | </code> |
- | Then the static configuration takes precedence. Two more improvements to come are: | + | Then the static configuration takes precedence. Two more improvements |
+ | to come are: | ||
* Update the cvs synchronization script so that we get notifications of commits from cvs. | * Update the cvs synchronization script so that we get notifications of commits from cvs. | ||
Line 88: | Line 102: | ||
===== Branch ACLs ===== | ===== Branch ACLs ===== | ||
- | Write access to specific branches can be limited. This is implemented in the update hook. | + | Write access to specific branches can be limited. This is implemented |
- | There are 2 files that control who can commit and on which branch: | + | in the update hook. There are 2 files that control who can commit and |
+ | on which branch: | ||
| | ||
| | ||
they are written in the file and they stop at the first match. If the username matches one of the user patterns on the first line matching the branch it will be allowed to commit, else if the branch matched it will be denied and if no branch pattern matched it depends on the **acl.defaultPolicy** config variable. | they are written in the file and they stop at the first match. If the username matches one of the user patterns on the first line matching the branch it will be allowed to commit, else if the branch matched it will be denied and if no branch pattern matched it depends on the **acl.defaultPolicy** config variable. | ||
- | & | + | <code> |
# Example: | # Example: | ||
# Format: branch_pattern user_pattern_list | # Format: branch_pattern user_pattern_list | ||
Line 113: | Line 128: | ||
# everybody can make any tag | # everybody can make any tag | ||
refs/ | refs/ | ||
- | & | + | </code> |
* **$GIT_DIR/ | * **$GIT_DIR/ | ||
Line 119: | Line 134: | ||
Config options: | Config options: | ||
- | * **acl.defaultPolicy** : if set to & | + | * **acl.defaultPolicy** : if set to "allow" |
- | * **acl.usernameBranches** : is set to & | + | * **acl.usernameBranches** : is set to "allow" |
is not explicitely allowed in the allowed-user file. | is not explicitely allowed in the allowed-user file. | ||
Example config acl section: | Example config acl section: | ||
- | & | + | <code> |
[acl] | [acl] | ||
defaultPolicy = deny | defaultPolicy = deny | ||
usernameBranches = allow | usernameBranches = allow | ||
- | & | + | </code> |