Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
git:ser-repository [2008/11/20 14:36] miconda |
git:ser-repository [2008/11/20 14:41] miconda |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Hacking SER or SIP-ROUTER | + | ====== Hacking SER with Git ====== |
Line 57: | Line 57: | ||
Note that the layout of the repository is slightly different than it used to be on berlios, see section Repository Layout. The cvs compatibility layer does not support tagging and branching, so you would need to use git for that. | Note that the layout of the repository is slightly different than it used to be on berlios, see section Repository Layout. The cvs compatibility layer does not support tagging and branching, so you would need to use git for that. | ||
- | ====== Mail Notifications ====== | ||
- | The central git repository can send email notifications whenever a contributor pushes commits into it. The mailing script is in $GIT_REPO/ | ||
- | |||
- | < | ||
- | [hooks] | ||
- | mailNotification = true | ||
- | </ | ||
- | |||
- | After that you need to configure the sender and recipient email addresses and a link to gitweb. These parameters belong to section mail: | ||
- | |||
- | < | ||
- | [mail] | ||
- | envelopeSender = admin@sip-router.org | ||
- | recipient = admin@sip-router.org | ||
- | gitwebURL = http:// | ||
- | </ | ||
- | |||
- | Parameter \' | ||
- | |||
- | Parameter \' | ||
- | |||
- | The mapping of usernames to email addresses is done using a static file. The original commitlog script used a static address in From. I then modified the script to extract the author information from the commit object so that we can use it in From and people can reply to commitlog messages directly -- reaching the author of the change. Unfortunately this did not work as I expected. A contributor might pull some changes from a private repository for somebody else and then the email address of that person would be in the author field and in From header of the commitlog, although the commit was done by somebody else. Then we tried to use the committer field from the 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\' | ||
- | |||
- | So I ended up adding a simple mapping file, it is in $GIT_DIR/ | ||
- | |||
- | format is \" | ||
- | |||
- | 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 *: | ||
- | < | ||
- | *=root@localhost | ||
- | </ | ||
- | |||
- | and I added a new configuration option to the git config where you can specify with mapping file will be used for the repository: | ||
- | |||
- | < | ||
- | [mail] | ||
- | envelopeSender = email_addr | ||
- | recipient = email_addr | ||
- | gitwebURL = http:// | ||
- | emailMap = $GIT_DIR/ | ||
- | </ | ||
- | |||
- | 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: | ||
- | |||
- | < | ||
- | [mail] | ||
- | from=admin@sip-router.org | ||
- | </ | ||
- | |||
- | 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. | ||
- | * Implement a new option which would allow us to explicitly set the list of branches that generate commit logs. | ||
- | |||
- | ====== Branch ACLs ====== | ||
- | |||
- | Write access to specific branches can be limited. This is implemented 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. | ||
- | < | ||
- | # Example: | ||
- | # Format: branch_pattern user_pattern_list | ||
- | # All the patterns are regular expressions, | ||
- | # A branch patter starting with a \' | ||
- | # non-fast-forwards are allowed. | ||
- | # The pattern evaluation stops on first match (so all user allowed to commit | ||
- | # on some branch should be listed on the same line) | ||
- | |||
- | # original ser branches are read only (only root is allowed to update them) | ||
- | refs/ | ||
- | |||
- | # everybody can do any change in tmp/* branches | ||
- | +refs/ | ||
- | |||
- | # everybody can commit on the master branch | ||
- | refs/ | ||
- | |||
- | # everybody can make any tag | ||
- | refs/ | ||
- | </ | ||
- | |||
- | * **$GIT_DIR/ | ||
- | was found in **$GIT_DIR/ | ||
- | |||
- | Config options: | ||
- | * **acl.defaultPolicy** : if set to \" | ||
- | * **acl.usernameBranches** : is set to \" | ||
- | is not explicitely allowed in the allowed-user file. | ||
- | |||
- | Example config acl section: | ||
- | < | ||
- | [acl] | ||
- | defaultPolicy = deny | ||
- | usernameBranches = allow | ||
- | </ | ||
- | |||
- | ====== Changelog ====== | ||
- | * \' | ||
- | * \' | ||
- | * \' | ||
- | * \' | ||
- | * \' | ||
- | * \' | ||
- | * \' | ||
- | * \' | ||
- | * \' | ||
- | |||
- | ====== Remember ====== | ||
- | * When setting up a repository that should be available through HTTP (i.e. dumb server), it is necessary to do \' | ||
- | |||
- | * Run \' | ||
- | |||
- | ====== References ====== | ||
- | * [1] Git homepage: http:// | ||
- | * [2] On using git: http:// | ||
- | * [3] wine git tools: http:// | ||
- | * [4] Git for computer scientists: http:// | ||