6.1. Writing Hooks
In order to enable synchronization of Subversion and Git repositories, SubGit installs hooks into Git repository. These hooks are:- Git pre-receive hook
- Git post-receive hook
Presence of these hooks is crucial for SubGit to function properly, and users should never modify or remove these hook scripts. If necessary, above hooks functionality should be placed into user-* scripts that would be called by SubGit at appropriate moments. SubGit install command takes care of already existing hooks and automatically places their contents into the corresponding user-* script files (see Figure 5.2, “Repository after install command is completed”).
Table below shows correspondence between standard hook scripts file names and file names that should be used to put hook functionality into after SubGit is installed. Hooks parameters and return code processing rules are not affected by SubGit. Hooks that are not listed in the table are not used by SubGit and their standard file names are not changed.
standard hook name hook name after SubGit is installed
pre-receive user-pre-receive
post-receive user-post-receive
On Windows OS .cmd or .bat extension should be added to Subversion hook file names.
- Git pre-receive hook
- Git post-receive hook
Presence of these hooks is crucial for SubGit to function properly, and users should never modify or remove these hook scripts. If necessary, above hooks functionality should be placed into user-* scripts that would be called by SubGit at appropriate moments. SubGit install command takes care of already existing hooks and automatically places their contents into the corresponding user-* script files (see Figure 5.2, “Repository after install command is completed”).
Table below shows correspondence between standard hook scripts file names and file names that should be used to put hook functionality into after SubGit is installed. Hooks parameters and return code processing rules are not affected by SubGit. Hooks that are not listed in the table are not used by SubGit and their standard file names are not changed.
standard hook name hook name after SubGit is installed pre-receive user-pre-receive post-receive user-post-receive
On Windows OS .cmd or .bat extension should be added to Subversion hook file names.
6.2. Applying configuration changes
SubGit configuration could be changed after SubGit is installed into repository. Some of the changes become effective immediately and others require subgit install or subgit install –rebuild command to be executed in order for the changes to be applied.Changes that become effective immediately:
- Modification of the authors mapping file (subgit/authors.txt)
- Modification of the password credentials file (subgit/passwd)
- Modification or creation of the user-* hook scripts
Changes that become effective after ‘subgit install’ is run:
- Modification of the core.authorsFile option in the subgit/config file
- Modification of the svn.fetchInterval option option in the subgit/config file
- Modification of the [auth] section options in the subgit/config file
subgit install command will validate changes made to the subgit/config file and will apply these changes. Background translation process will be restarted if needed.
Other configuration changes: In case more changes have to be made, in particular, changes to the branches mapping in subgit/config file, then the easiest way would be to reinstall SubGit following standard configuration stages (see Section 5.1, “Installation Stages”). It is not possible to update branches mapping for a Git repository where SubGit is already installed. To stop background translation process, run subgit uninstall command on a Git repository.
Changes that become effective immediately:
- Modification of the authors mapping file (subgit/authors.txt)
- Modification of the password credentials file (subgit/passwd)
- Modification or creation of the user-* hook scripts
Changes that become effective after ‘subgit install’ is run:
- Modification of the core.authorsFile option in the subgit/config file
- Modification of the svn.fetchInterval option option in the subgit/config file
- Modification of the [auth] section options in the subgit/config file
subgit install command will validate changes made to the subgit/config file and will apply these changes. Background translation process will be restarted if needed.
Other configuration changes: In case more changes have to be made, in particular, changes to the branches mapping in subgit/config file, then the easiest way would be to reinstall SubGit following standard configuration stages (see Section 5.1, “Installation Stages”). It is not possible to update branches mapping for a Git repository where SubGit is already installed. To stop background translation process, run subgit uninstall command on a Git repository.