summaryrefslogtreecommitdiff
path: root/etc/functions
diff options
context:
space:
mode:
Diffstat (limited to 'etc/functions')
-rw-r--r--etc/functions/git-hook7
1 files changed, 4 insertions, 3 deletions
diff --git a/etc/functions/git-hook b/etc/functions/git-hook
index bb44e05..5243ee1 100644
--- a/etc/functions/git-hook
+++ b/etc/functions/git-hook
@@ -14,7 +14,8 @@ if [[ -n $GIT_DIR && -d $GIT_DIR ]] {
} elif [[ $PWD == */hooks ]] {
hook_dir=$PWD
} else {
- fdie 'No git or hook directory found.'; return
+ hook_dir=$(git rev-parse --git-dir)/hooks ||
+ return
}
function usage {
@@ -26,7 +27,7 @@ function usage {
function hook_enable {
if [[ -e $hook_dir/$hook ]] {
if ! [[ -x $hook_dir/$hook ]] {
- chmod u+x $hook_dir/$hook
+ chmod +x $hook_dir/$hook
}
} else {
fdie "No such hook: '$hook'"; return
@@ -36,7 +37,7 @@ function hook_enable {
function hook_disable {
if [[ -e $hook_dir/$hook ]] {
if [[ -x $hook_dir/$hook ]] {
- chmod u-x $hook_dir/$hook
+ chmod -x $hook_dir/$hook
}
} else {
fdie "No such hook: '$hook'"; return