You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the post-command hook runs, we could be in several custom states:
1. The command is a regular builtin, but the repo setup is incomplete.
(Example: "git version", "git rev-parse HEAD")
2. The command is a dashed command, but the top level process uses a space
in its call. (Example: "git http-request")
3. The command is an alias that goes to a builtin.
4. The command has no arguments or is only helptext.
Each of these cases leads to a place where we previously had not loaded the
postCommand.strategy config and would execute the post-command hook without
looking for a sentinel file.
There are two fixes here:
First, we use early config parsing so we can get config details without
fully setting up the repository. This is how core.hooksPath works in these
situations.
Second, we need to make sure handle_hook_replacement() is called even when
the repo's gitdir is NULL. This requires a small amount of care to say that
a sentinel file cannot exist if the gitdir isn't set, as we would not have
written one without initializing the gitdir.
This gets all of the desired behaviors we want for this setting without
doing anything extreme with how pre- and post-command hooks run otherwise.
Signed-off-by: Derrick Stolee <stolee@gmail.com>
0 commit comments