Documentation: document post-rewrite hook
This defines the behaviour of the post-rewrite hook support, which will be implemented in the following patches. We deliberately do not document how often the hook will be invoked per rewriting command, but the interface is designed to keep that at "once". This would currently not matter too much, since both rebase and filter-branch are shellscripts and spawn many processes anyway. However, when a fast sequencer in C is implemented, it will be beneficial to only have to run the hook once. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Rast committed
Mar 12, 2010 at 18:04 UTC
c0fc6869112e07cda2faff73670480df0d82d530
1 file changed
+34
Documentation/githooks.txt
+34
@@ -317,6 +317,40 @@ This hook is invoked by 'git gc --auto'. It takes no parameter, and
317
exiting with non-zero status from this script causes the 'git gc --auto'
318
to abort.
319
320
+post-rewrite
321
+~~~~~~~~~~~~
322
+
323
+This hook is invoked by commands that rewrite commits (`git commit
324
+--amend`, 'git-rebase'; currently 'git-filter-branch' does 'not' call
325
+it!). Its first argument denotes the command it was invoked by:
326
+currently one of `amend` or `rebase`. Further command-dependent
327
+arguments may be passed in the future.
328
+
329
+The hook receives a list of the rewritten commits on stdin, in the
330
+format
331
+
332
+ <old-sha1> SP <new-sha1> [ SP <extra-info> ] LF
333
+
334
+The 'extra-info' is again command-dependent. If it is empty, the
335
+preceding SP is also omitted. Currently, no commands pass any
336
+'extra-info'.
337
+
338
+The following command-specific comments apply:
339
+
340
+rebase::
341
+ For the 'squash' and 'fixup' operation, all commits that were
342
+ squashed are listed as being rewritten to the squashed commit.
343
+ This means that there will be several lines sharing the same
344
+ 'new-sha1'.
345
++
346
+The commits are guaranteed to be listed in the order that they were
347
+processed by rebase.
348
+
349
+There is no default 'post-rewrite' hook, but see the
350
+`post-receive-copy-notes` script in `contrib/hooks` for an example
351
+that copies your git-notes to the rewritten commits.
352
+
353
+
354
GIT
355
---
356
Part of the linkgit:git[1] suite