Making git hooks visible in fish shell 0 ▲ Ideas.Offby1 1 hour ago · Tech · hide · 0 comments I saw Ned Batchelder's post about a zsh function to show git hooks in the current repository, which was in turn inspired by a post by Frank Wiles, detailing a hack that nearly got him, reliant on sketchy git hooks in a shared folder. I use fish shell, though, not zsh, so here's my version of the same script. I put this in ~/.config/fish/functions/_show_git_hooks.fish: function _show_git_hooks --on-variable PWD set -l git_dir (git rev-parse --git-dir 2>/dev/null) if ! test -d "$git_dir/hooks" # clear the shown hooks dir, since we have left a repo set -e _git_shown_hooks_dir return end set -l hooks_dir_rel "$git_dir/hooks" set -l hooks_dir (realpath -- "$hooks_dir_rel") # only announce once per repo, since this function is called on every prompt if set -q _git_shown_hooks_dir if test "$_git_shown_hooks_dir" = "$hooks_dir" return end end set -g _git_shown_hooks_dir "$hooks_dir" set -l hooks for hook in (find "$hooks_dir" -type f | sort) if test -x "$hook"; and not string match -q… No comments yet. Log in to reply on the Fediverse. Comments will appear here.