Sam Vilain [off-list ref] writes:
quoted hunk
Add a simple hook that will run before checkouts.
Signed-off-by: Sam Vilain <redacted>
---
Documentation/githooks.txt | 20 +++++++++++++++-----
builtin-checkout.c | 25 ++++++++++++++++++++++---
2 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index 06e0f31..8dc3fbf 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -143,21 +143,31 @@ pre-rebase
This hook is called by 'git-rebase' and can be used to prevent a branch
from getting rebased.
+pre-checkout
+-----------
-post-checkout
-~~~~~~~~~~~~~
-
-This hook is invoked when a 'git-checkout' is run after having updated the
+This hook is invoked when a 'git-checkout' is run after before updating the
"after before"?
worktree. The hook is given three parameters: the ref of the previous HEAD,
the ref of the new HEAD (which may or may not have changed), and a flag
indicating whether the checkout was a branch checkout (changing branches,
flag=1) or a file checkout (retrieving a file from the index, flag=0).
-This hook cannot affect the outcome of 'git-checkout'.
+This hook can prevent the checkout from proceeding by exiting with an
+error code.
It is also run after 'git-clone', unless the --no-checkout (-n) option is
used. The first parameter given to the hook is the null-ref, the second the
ref of the new HEAD and the flag is always 1.
+This hook can be used to perform any clean-up deemed necessary before
+checking out the new branch/files.
+
+post-checkout
+-----------
This is not about your patch, but the patch text shows that our diff
algorithm seems to have a room for improvement. I expected to see a
straight insersion of block of text, not touching anything in the original
section on post-checkout hook.
Junio C Hamano wrote:
Sam Vilain [off-list ref] writes:
quoted
Add a simple hook that will run before checkouts.
Signed-off-by: Sam Vilain <redacted>
---
Documentation/githooks.txt | 20 +++++++++++++++-----
builtin-checkout.c | 25 ++++++++++++++++++++++---
2 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index 06e0f31..8dc3fbf 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -143,21 +143,31 @@ pre-rebase
This hook is called by 'git-rebase' and can be used to prevent a branch
from getting rebased.
+pre-checkout
+-----------
-post-checkout
-~~~~~~~~~~~~~
-
-This hook is invoked when a 'git-checkout' is run after having updated the
+This hook is invoked when a 'git-checkout' is run after before updating the
"after before"?
*ahem* whoops :). I think I got the heading style wrong too...
This is not about your patch, but the patch text shows that our diff
algorithm seems to have a room for improvement. I expected to see a
straight insersion of block of text, not touching anything in the original
section on post-checkout hook.
Correct. This is because the paragraph explaining when the hook runs
has been moved to the pre-checkout paragraph, which appears before the
post-checkout section. I just compared the output to 'diff -du' and it
seems to be the same, so I wouldn't worry too much.
--
Sam Vilain, Perl Hacker, Catalyst IT (NZ) Ltd.
phone: +64 4 499 2267 PGP ID: 0x66B25843
On Tue, Oct 13, 2009 at 10:13:39PM -0700, Junio C Hamano wrote:
quoted
worktree. The hook is given three parameters: the ref of the previous HEAD,
the ref of the new HEAD (which may or may not have changed), and a flag
indicating whether the checkout was a branch checkout (changing branches,
flag=1) or a file checkout (retrieving a file from the index, flag=0).
-This hook cannot affect the outcome of 'git-checkout'.
+This hook can prevent the checkout from proceeding by exiting with an
+error code.
It is also run after 'git-clone', unless the --no-checkout (-n) option is
used. The first parameter given to the hook is the null-ref, the second the
ref of the new HEAD and the flag is always 1.
+This hook can be used to perform any clean-up deemed necessary before
+checking out the new branch/files.
+
+post-checkout
+-----------
This is not about your patch, but the patch text shows that our diff
algorithm seems to have a room for improvement. I expected to see a
straight insersion of block of text, not touching anything in the original
section on post-checkout hook.
I think it's right as-is. He changed the title of the section, made a
few tweaks in the text to make it appropriate for "pre-checkout", and
then made a new post-checkout section that says "This is just like
pre-checkout". So most of the lines were left untouched. Short of our
diff understanding the block-formatting of asciidoc, I think it's as
good as we can get.
-Peff