summaryrefslogtreecommitdiff
path: root/git-checkout.sh
diff options
context:
space:
mode:
authorJosh England <jjengla@sandia.gov>2007-09-26 21:31:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-09-30 04:11:21 (GMT)
commit1abbe475ff17349839f72a024cf665b8ec86473f (patch)
tree19b2213ce48607549de06689c43f31a581a6e41c /git-checkout.sh
parent2a858ee95134926a0ccccb9a78db06bcb0bd65d0 (diff)
downloadgit-1abbe475ff17349839f72a024cf665b8ec86473f.zip
git-1abbe475ff17349839f72a024cf665b8ec86473f.tar.gz
git-1abbe475ff17349839f72a024cf665b8ec86473f.tar.bz2
post-checkout hook, tests, and docs
Updated post-checkout hook to take a flag specifying whether the checkout is a branch checkout or a file checkout (from the index). Signed-off-by: Josh England <jjengla@sandia.gov> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-checkout.sh')
-rwxr-xr-xgit-checkout.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/git-checkout.sh b/git-checkout.sh
index 17f4392..8993920 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -137,6 +137,13 @@ Did you intend to checkout '$@' which can not be resolved as commit?"
git ls-files --error-unmatch -- "$@" >/dev/null || exit
git ls-files -- "$@" |
git checkout-index -f -u --stdin
+
+ # Run a post-checkout hook -- the HEAD does not change so the
+ # current HEAD is passed in for both args
+ if test -x "$GIT_DIR"/hooks/post-checkout; then
+ "$GIT_DIR"/hooks/post-checkout $old $old 0
+ fi
+
exit $?
else
# Make sure we did not fall back on $arg^{tree} codepath
@@ -284,3 +291,8 @@ if [ "$?" -eq 0 ]; then
else
exit 1
fi
+
+# Run a post-checkout hook
+if test -x "$GIT_DIR"/hooks/post-checkout; then
+ "$GIT_DIR"/hooks/post-checkout $old $new 1
+fi