aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-10-19 16:05:58 -0700
committerJunio C Hamano <gitster@pobox.com>2008-10-19 16:05:58 -0700
commitce6e5ff435f325769dd28980cf3c8b1625f194f2 (patch)
treea903e06ed0f4cfb9fb1f8f484907baa57b7d2b0a
parent3aa615bc5d5348d732b5b1354cc3517a55b34a6f (diff)
parentfd631d5828ec6b89e86e0568e5e798787fed9bbd (diff)
downloadgit-ce6e5ff435f325769dd28980cf3c8b1625f194f2.tar.gz
git-ce6e5ff435f325769dd28980cf3c8b1625f194f2.tar.xz
Merge branch 'ns/rebase-noverify'
* ns/rebase-noverify: rebase: Document --no-verify option to bypass pre-rebase hook rebase --no-verify
-rw-r--r--Documentation/git-rebase.txt5
-rwxr-xr-xgit-rebase--interactive.sh10
-rwxr-xr-xgit-rebase.sh7
-rwxr-xr-xt/t3409-rebase-hook.sh16
4 files changed, 35 insertions, 3 deletions
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 32f0f122e..4e8438098 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -9,7 +9,7 @@ SYNOPSIS
--------
[verse]
'git rebase' [-i | --interactive] [-v | --verbose] [-m | --merge]
- [-s <strategy> | --strategy=<strategy>]
+ [-s <strategy> | --strategy=<strategy>] [--no-verify]
[-C<n>] [ --whitespace=<option>] [-p | --preserve-merges]
[--onto <newbase>] <upstream> [<branch>]
'git rebase' --continue | --skip | --abort
@@ -232,6 +232,9 @@ OPTIONS
--verbose::
Display a diffstat of what changed upstream since the last rebase.
+--no-verify::
+ This option bypasses the pre-rebase hook. See also linkgit:githooks[5].
+
-C<n>::
Ensure at least <n> lines of surrounding context match before
and after each change. When fewer lines of surrounding
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 124cb5846..86290f63b 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -26,6 +26,7 @@ i,interactive always used (no-op)
continue continue rebasing process
abort abort rebasing process and restore original branch
skip skip current patch and continue rebasing process
+no-verify override pre-rebase hook from stopping the operation
"
. git-sh-setup
@@ -41,6 +42,7 @@ PRESERVE_MERGES=
STRATEGY=
ONTO=
VERBOSE=
+OK_TO_SKIP_PRE_REBASE=
GIT_CHERRY_PICK_HELP=" After resolving the conflicts,
mark the corrected paths with 'git add <paths>', and
@@ -66,7 +68,8 @@ output () {
}
run_pre_rebase_hook () {
- if test -x "$GIT_DIR/hooks/pre-rebase"
+ 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."
@@ -421,6 +424,11 @@ get_saved_options () {
while test $# != 0
do
case "$1" in
+ --no-verify)
+ OK_TO_SKIP_PRE_REBASE=yes
+ ;;
+ --verify)
+ ;;
--continue)
is_standalone "$@" || usage
get_saved_options
diff --git a/git-rebase.sh b/git-rebase.sh
index a30d40c00..f2742aa05 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -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\".
@@ -145,7 +146,8 @@ is_interactive () {
}
run_pre_rebase_hook () {
- if test -x "$GIT_DIR/hooks/pre-rebase"
+ 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."
@@ -170,6 +172,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?"
diff --git a/t/t3409-rebase-hook.sh b/t/t3409-rebase-hook.sh
index bc93dda8f..1f1b85067 100755
--- a/t/t3409-rebase-hook.sh
+++ b/t/t3409-rebase-hook.sh
@@ -123,4 +123,20 @@ test_expect_success 'pre-rebase hook stops rebase (2)' '
test 0 = $(git rev-list HEAD...side | wc -l)
'
+test_expect_success 'rebase --no-verify overrides pre-rebase (1)' '
+ git checkout test &&
+ git reset --hard side &&
+ git rebase --no-verify master &&
+ test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
+ test "z$(cat git)" = zworld
+'
+
+test_expect_success 'rebase --no-verify overrides pre-rebase (2)' '
+ git checkout test &&
+ git reset --hard side &&
+ EDITOR=true git rebase --no-verify -i master &&
+ test "z$(git symbolic-ref HEAD)" = zrefs/heads/test &&
+ test "z$(cat git)" = zworld
+'
+
test_done