1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect2 SYSTEM "../../../dtd/dblite.dtd">
\r
3 <sect2 id="tgit-dug-settings-hooks">
\r
4 <title>Client Side Hook Scripts</title>
\r
5 <?dbhh topicname="HIDD_SETTINGSHOOKS"?>
\r
6 <?dbhh topicname="HIDD_SETTINGSHOOKCONFIG"?>
\r
8 <primary>client hooks</primary>
\r
11 <primary>hook scripts</primary>
\r
14 <figure id="tgit-dug-settings-dia-hooks">
\r
15 <title>The Settings Dialog, Hook Scripts Page</title>
\r
16 <graphic fileref="../images/SettingsHooks.png"/>
\r
18 This dialog allows you to set up hook scripts which will be
\r
19 executed automatically when certain TortoiseGit actions are performed on the client side.
\r
22 For various security and implementation reasons, hook scripts are defined
\r
23 locally on a machine, rather than as project properties. You define what
\r
24 happens, no matter what someone else commits to the repository. Of course
\r
25 you can always choose to call a script which is itself under version control.
\r
28 <figure id="tgit-dug-settings-dia-hook-edit">
\r
29 <title>The Settings Dialog, Configure Hook Scripts</title>
\r
30 <graphic fileref="../images/SettingsHookEdit.png"/>
\r
32 To add a new hook script, simply click <guibutton>Add</guibutton>
\r
33 and fill in the details.
\r
36 There are currently six types of hook script available
\r
39 <term>Start-commit</term>
\r
42 Called before the commit dialog is shown.
\r
43 You might want to use this if the hook modifies a versioned
\r
44 file and affects the list of files that need to be committed
\r
45 and/or commit message. However you should note that because
\r
46 the hook is called at an early stage, the full list of objects
\r
47 selected for commit is not available.
\r
52 <term>Pre-commit</term>
\r
55 Called after the user clicks <guibutton>OK</guibutton>
\r
56 in the commit dialog, and before the actual commit begins.
\r
57 This hook has a list of exactly what will be committed.
\r
63 <term>Post-commit</term>
\r
66 Called after the commit finishes (whether successful or not).
\r
72 <term>Pre-push</term>
\r
75 Called before actual Git push begins.
\r
80 <term>Post-push</term>
\r
83 Called after pushing finishes (whether successful or not).
\r
90 A hook is defined for a particular working tree path. You only need to
\r
91 specify the top level path; if you perform an operation in a sub-folder,
\r
92 TortoiseGit will automatically search upwards for a matching path.
\r
95 Next you must specify the command line to execute, starting with the path
\r
96 to the hook script or executable.
\r
97 This could be a batch file, an executable file or any other file which
\r
98 has a valid windows file association, eg. a perl script.
\r
101 The command line includes several parameters which get filled in
\r
102 by TortoiseGit. The parameters passed depend upon which hook is called.
\r
103 Each hook has its own parameters which are passed in the following order:
\r
106 <term>Start-commit</term>
\r
107 <listitem condition="pot">
\r
109 <literal>PATH</literal>
\r
110 <literal>MESSAGEFILE</literal>
\r
111 <literal>CWD</literal>
\r
116 <term>Pre-commit</term>
\r
117 <listitem condition="pot">
\r
119 <literal>PATH</literal>
\r
120 <literal>MESSAGEFILE</literal>
\r
121 <literal>CWD</literal>
\r
127 <term>Post-commit</term>
\r
128 <listitem condition="pot">
\r
130 <literal>PATH</literal>
\r
131 <literal>MESSAGEFILE</literal>
\r
132 <literal>REVISION</literal>
\r
133 <literal>ERROR</literal>
\r
134 <literal>CWD</literal>
\r
140 <term>Pre-push</term>
\r
141 <listitem condition="pot">
\r
143 <literal>PATH</literal>
\r
144 <literal>ERROR</literal>
\r
145 <literal>CWD</literal>
\r
150 <term>Post-push</term>
\r
151 <listitem condition="pot">
\r
153 <literal>PATH</literal>
\r
154 <literal>ERROR</literal>
\r
155 <literal>CWD</literal>
\r
162 The meaning of each of these parameters is described here:
\r
165 <term condition="pot">PATH</term>
\r
168 A path to a temporary file which contains all the
\r
169 paths for which the operation was started.
\r
170 Each path is on a separate line in the temp file.
\r
175 <term condition="pot">MESSAGEFILE</term>
\r
178 Path to a file containing the log message for
\r
179 the commit. The file contains the text in UTF-8
\r
180 encoding. After successful execution of the
\r
181 start-commit and pre-commit hooks, the log message is read back,
\r
182 giving the hook a chance to modify it.
\r
188 <term condition="pot">REVISION</term>
\r
191 The repository revision to which the update should
\r
192 be done or after a commit completes.
\r
198 <term condition="pot">ERROR</term>
\r
201 Path to a file containing the error message.
\r
202 If there was no error, the file will be empty.
\r
207 <term condition="pot">CWD</term>
\r
210 The current working directory with which the script is run.
\r
211 This is set to the working tree root.
\r
218 Note that although we have given these parameters names for convenience,
\r
219 you do not have to refer to those names in the hook settings.
\r
220 All parameters listed for a particular hook are always passed,
\r
221 whether you want them or not ;-)
\r
224 If you want the Git operation to hold off until the hook has completed,
\r
225 check <guilabel>Wait for the script to finish</guilabel>.
\r
228 Normally you will want to hide ugly DOS boxes when the script runs,
\r
229 so <guilabel>Hide the script while running</guilabel> is checked by default.
\r
231 <sect3 id="tgit-dug-settings-hooks-issuetracker">
\r
232 <title>Issue Tracker Integration</title>
\r
233 <?dbhh topicname="HIDD_SETTINGSBUGTRAQ"?>
\r
234 <?dbhh topicname="HIDD_SETTINGSBUGTRAQADV"?>
\r
236 TortoiseGit can use a COM plugin to query issue trackers when in the
\r
237 commit dialog. The use of such plugins is described in
\r
238 <xref linkend="tgit-dug-bugtracker-ref" />.
\r
239 If your system administrator has provided you with a plugin, which
\r
240 you have already installed and registered, this is the place to
\r
241 specify how it integrates with your working tree.
\r
244 There is also a hierarchical git configuration to associate issue tracker plugin with your project,
\r
245 rather than with to a specific directory path. Such settings are more portable.
\r
246 See <xref linkend="tgit-dug-bugtracker"/> to configure these settings.
\r
249 <figure id="tgit-dug-settings-dia-issuetracker">
\r
250 <title>The Settings Dialog, Issue Tracker Integration Page</title>
\r
251 <graphic fileref="../images/SettingsIssueTrackerIntegration.png"/>
\r
252 <graphic fileref="../images/SettingsIssueTracker.png"/>
\r
254 Click on <guibutton>Add...</guibutton> to use the plugin with
\r
255 a particular working tree. Here you can specify the working tree
\r
256 path, choose which plugin to use from a drop down list of all
\r
257 registered issue tracker plugins, and any parameters to pass.
\r
258 The parameters will be specific to the plugin, but might include
\r
259 your user name on the issue tracker so that the plugin can
\r
260 query for issues which are assigned to you.
\r
263 <sect3 id="tgit-dug-settings-hooks-issuetracker-config">
\r
264 <title>Config</title>
\r
266 <figure id="tgit-dug-settings-hooks-issuetrack-config">
\r
267 <title>The Settings Dialog, Issue Tracker Config</title>
\r
268 <graphic fileref="../images/SettingsIssueTrackerConfig.png"/>
\r
270 See <xref linkend="tgit-dug-bugtracker"/> for a descriptions of the different options.
\r
274 If you have problems entering/storing data please see <xref linkend="tgit-dug-settings-hierachical"/>.
\r