On Wed, Aug 26, 2020 at 5:48 PM Tom Rutherford <tmrutherford@xxxxxxxxx> wrote: > > Thank you for the response Junio. > > For what it's worth, my hook does not make changes to the repo. It's > running a command to check that the installed version of our > dependencies match the version specified in the commit being checked > out, and merely warns if the two don't match (then exits with a > nonzero return code). I've run into this before myself. The core of the bug is that when `git checkout` runs the post-checkout hook, whatever exit status that hook has, `git checkout` has the same exit status. This might be intended as a feature, but if so, the documentation needs a tweak: the githooks docs say in part This hook cannot affect the outcome of git checkout. If "outcome" includes exit status -- to me, it does -- either the docs are wrong or the code is wrong. > For this reason it's been convenient that the hook runs during > rebases, but I find it surprising that the nonzero return code would > impact the rebase. I have to agree with this, too. (The simplest fix would be to have `git checkout` ignore the status from the post-checkout hook, of course, and just exit 0 for success.) Chris