I am following the steps outlined in the below link to ensure that my hooks are rerun every time upon git init:
Getting started with Ctags with Vim and Git.
Since I don't have fish installed, I replaced the function git-reload-hooks-all.fish in the link with the following bash script:
#!/bin/bash
read -rp "Enter repo: " repo
cd "$repo/.git/hooks" || exit
rm -fv ./*
cp ~/.git_template/hooks/* .
cd "$GITWORKSPACE/$repo" || exit
git init
$GITWORKSPACE in my set up points to the top-level directory that contains all the individual git repositories.
When I execute the script for a chosen git repository under $GITWORKSPACE, it runs successfully and I can see the following message printed on the terminal:
Reinitialized existing git repository in $GITWORKSPACE/$repo/.git
Note that the variables are replaced by the actual paths in the above output.
I can also see that ./git/hooks/ folder has been updated with the hooks I want.
However, the ctags hook outlined in the link above has not been run, and I cannot see any .tag file under $GITWORKSPACE/$repo/ path.
Can someone tell me why git init fails to rerun the hooks?
TIA
As the tutorial says,
ctagsis called in the hookspost-checkout,post-commit,post-merge,post-rewrite.git initdoes not invoke any of these hooks. As the hook names suggest, they are invoked by other commands. And,postindicates it runs after the command finishes. Thepostfamily cannot affect the exit code of the command. For example,post-checkoutis invoked bygit checkoutorgit switch. You can find the details in githooks.You can try
git checkout,git commit,git mergeandgit rebaseto test ifctagsruns as expected.