Commit 2fd75c10 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Added 'enable' & 'disable' commands

'enable' & 'disable' commands set & unset, respectively, the executable
bit on the given script in the given hook directory.
parent c84ba83f
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -133,6 +133,34 @@ cmd_remove ()
	rm "$GIT_DIR"/hooks/$hook.d/"$script"
}

cmd_enable ()
{
	summary="enable a script from a hook"
	local hook script
	add_option hook yes
	add_option script yes
	parse_args "$@" || return
	_basic_check
	_change_check
	_installed_check

	chmod +x "$GIT_DIR"/hooks/$hook.d/"$script"
}

cmd_disable ()
{
	summary="disable a script from a hook"
	local hook script
	add_option hook yes
	add_option script yes
	parse_args "$@" || return
	_basic_check
	_change_check
	_installed_check

	chmod -x "$GIT_DIR"/hooks/$hook.d/"$script"
}

cmd_installed ()
{
	summary="show scripts installed under a hook"