This test for a bare repo is unreliable as it requires 'hooks' to strictly be of type 'file'.
In many environments, for example GitLab this test will fail because hooks is a symlink, not a 'file', its a symlink:
# file hooks
hooks: symbolic link to `/opt/gitlab/embedded/service/gitlab-shell/hooks'
I suggest changing the -f to -e so it works if 'hooks' exists as a file or symlink.