X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-rebase.sh;h=f84160d32456820765e5b4f899a2fdd0aa5bf9cd;hb=9b6c66e05cc26cc5f688b0e700ee0cb151fc6c09;hp=16d4359830d7f987f571f8d3520f60062f60fab6;hpb=32d9954478734da4062cf2ffc2faf2d057e47fb6;p=git.git diff --git a/git-rebase.sh b/git-rebase.sh index 16d43598..f84160d3 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -36,6 +36,15 @@ other=$(git-rev-parse --verify "$1^0") || usage # Make sure the branch to rebase is valid. head=$(git-rev-parse --verify "${2-HEAD}^0") || exit +# If a hook exists, give it a chance to interrupt +if test -x "$GIT_DIR/hooks/pre-rebase" +then + "$GIT_DIR/hooks/pre-rebase" ${1+"$@"} || { + echo >&2 "The pre-rebase hook refused to rebase." + exit 1 + } +fi + # If the branch to rebase is given, first switch to it. case "$#" in 2)