Re: [PATCH] post-checkout hook, and related docs and tests
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:36
"root" [off-list ref] writes:
+post-checkout +----------- + +This hook is invoked when a `git-checkout` is run on a local repository. +The hook is given two parameters: the ref of the previous HEAD, and the ref of +the new HEAD. This hook cannot affect the outcome of `git-checkout`. + +This hook can be used to perform repository validity checks, auto-display +differences from the previous HEAD, or set working dir metadata properties. +
People may wonder why this is not run when they do "git checkout otherbranch path.c"; the second sentence from the above description implies why it shouldn't, but the first sentence probably should state it more clearly. What's the _semantics_ you are trying to achieve? Why does the hook run every time git-bisect suggests the next revision to try? Why does the hook run when rebase starts its work? When "git pull" or "git merge" results in a fast forward, the situation is no different from checking out a new revision. Why doesn't the hook run in these cases?