]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-rebase.sh
Merge git://repo.or.cz/git-gui
[git.git] / git-rebase.sh
index 03e5f95051382fb1a9b811e9974cb5424fee883b..023a6dc94a48f7abf2801359ad68d40909e9b6aa 100755 (executable)
@@ -34,6 +34,7 @@ set_reflog_action rebase
 require_work_tree
 cd_to_toplevel
 
+OK_TO_SKIP_PRE_REBASE=
 RESOLVEMSG="
 When you have resolved this problem run \"git rebase --continue\".
 If you would prefer to skip this patch, instead run \"git rebase --skip\".
@@ -160,6 +161,17 @@ is_interactive () {
        test -n "$interactive_rebase" || test -f "$dotest"/interactive
 }
 
+run_pre_rebase_hook () {
+       if test -z "$OK_TO_SKIP_PRE_REBASE" &&
+          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
+}
+
 test -f "$GIT_DIR"/rebase-apply/applying &&
        die 'It looks like git-am is in progress. Cannot rebase.'
 
@@ -176,6 +188,9 @@ fi
 while test $# != 0
 do
        case "$1" in
+       --no-verify)
+               OK_TO_SKIP_PRE_REBASE=yes
+               ;;
        --continue)
                test -d "$dotest" -o -d "$GIT_DIR"/rebase-apply ||
                        die "No rebase in progress?"
@@ -336,13 +351,7 @@ onto_name=${newbase-"$upstream_name"}
 onto=$(git rev-parse --verify "${onto_name}^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
+run_pre_rebase_hook ${1+"$@"}
 
 # If the branch to rebase is given, that is the branch we will rebase
 # $branch_name -- branch being rebased, or HEAD (already detached)