From c8b3364d0939fd1ef821cc1033c7803051e0b5d9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 4 Apr 2009 23:49:22 +0200 Subject: Removed unused (and probably obsolete) git-hook function --- etc/completions/_git-hook | 31 ------------------------ etc/functions/git-hook | 61 ----------------------------------------------- 2 files changed, 92 deletions(-) delete mode 100644 etc/completions/_git-hook delete mode 100755 etc/functions/git-hook diff --git a/etc/completions/_git-hook b/etc/completions/_git-hook deleted file mode 100644 index cdf15a7..0000000 --- a/etc/completions/_git-hook +++ /dev/null @@ -1,31 +0,0 @@ -#compdef git-hook -## Completion for the git-hook function, see ../functions/git-hook -## Copyright (C) 2008 by Daniel Friesel -## License: WTFPL - -typeset hook_dir expl - -if [[ -n $GIT_DIR && -d $GIT_DIR ]] { - hook_dir=$GIT_DIR/hooks -} elif [[ -d .git/hooks ]] { - hook_dir=$PWD/.git/hooks -} elif [[ -d hooks ]] { - hook_dir=$PWD/hooks -} elif [[ $PWD == */hooks ]] { - hook_dir=$PWD -} else { - hook_dir=$(git rev-parse --git-dir)/hooks -} - -if (( CURRENT == 2 )) { - _wanted ation expl 'action' \ - compadd list enable disable -} elif (( CURRENT == 3 )) { - if [[ ${words[2]} == 'enable' ]] { - _wanted hook expl 'git hook' \ - _path_files -W $hook_dir -g '*(^x)' - } elif [[ ${words[2]} == 'disable' ]] { - _wanted hook expl 'git hook' \ - _path_files -W $hook_dir -g '*(x)' - } -} diff --git a/etc/functions/git-hook b/etc/functions/git-hook deleted file mode 100755 index 86c2bbb..0000000 --- a/etc/functions/git-hook +++ /dev/null @@ -1,61 +0,0 @@ -## vim:ft=zsh -## Small function to help with git hooks -## Copyright (C) 2008 by Daniel Friesel -## License: WTFPL - -autoload fdie -typeset hook_dir action=${1=list} hook=$2 - -if [[ -n $GIT_DIR && -d $GIT_DIR ]] { - hook_dir=$GIT_DIR/hooks -} elif [[ -d .git/hooks ]] { - hook_dir=$PWD/.git/hooks -} elif [[ -d hooks ]] { - hook_dir=$PWD/hooks -} elif [[ $PWD == */hooks ]] { - hook_dir=$PWD -} else { - hook_dir=$(git rev-parse --git-dir)/hooks || - return -} - -function usage { - cat <<- ENDOFHELP - Usage: git-hook enable|disable - ENDOFHELP -} - -function hook_enable { - if [[ -e $hook_dir/$hook ]] { - if ! [[ -x $hook_dir/$hook ]] { - chmod +x $hook_dir/$hook - } - } else { - fdie "No such hook: '$hook'"; return - } -} - -function hook_disable { - if [[ -e $hook_dir/$hook ]] { - if [[ -x $hook_dir/$hook ]] { - chmod -x $hook_dir/$hook - } - } else { - fdie "No such hook: '$hook'"; return - } -} - -function hook_list { - for hook in $hook_dir/*; { - [[ -x $hook ]] && echo -n $green - echo -n ${hook:t} - echo $reset - } -} - -case $action in - enable) shift 2; hook_enable $* ;; - disable) shift 2; hook_disable $* ;; - list) shift; hook_list $* ;; - *) usage ;; -esac -- cgit v1.2.3