summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorEric Sunshine <sunshine@sunshineco.com>2017-12-07 21:20:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-07 22:02:28 (GMT)
commitade546be4786637ba039478d6f027becb1160803 (patch)
treefec3e4c4218543e1871e7739dc9f432e04eb16be /Documentation
parent95ec6b1b3393eb6e26da40c565520a8db9796e9f (diff)
downloadgit-ade546be4786637ba039478d6f027becb1160803.zip
git-ade546be4786637ba039478d6f027becb1160803.tar.gz
git-ade546be4786637ba039478d6f027becb1160803.tar.bz2
worktree: invoke post-checkout hook (unless --no-checkout)
git-clone and git-checkout both invoke the post-checkout hook following a successful checkout, yet git-worktree neglects to do so even though it too "checks out" the worktree. Fix this oversight. Implementation note: The newly-created worktree may reference a branch or be detached. In the latter case, a commit lookup is performed, though the result is used only in a boolean sense to (a) determine if the commit actually exists, and (b) assign either the branch name or commit ID to HEAD. Since the post-commit hook needs to know the ID of the checked-out commit, the lookup now needs to be done in all cases, rather than only when detached. Consequently, a new boolean is needed to handle (b) since the lookup result itself can no longer perform that role. Reported-by: Matthew K Gumbel <matthew.k.gumbel@intel.com> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/githooks.txt3
1 files changed, 2 insertions, 1 deletions
diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt
index 0bb0042..91eb297 100644
--- a/Documentation/githooks.txt
+++ b/Documentation/githooks.txt
@@ -170,7 +170,8 @@ This hook cannot affect the outcome of 'git checkout'.
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.
+ref of the new HEAD and the flag is always 1. Likewise for 'git worktree add'
+unless --no-checkout is used.
This hook can be used to perform repository validity checks, auto-display
differences from the previous HEAD if different, or set working dir metadata