Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanako Shiraishi <nanako3@lavabit.com>2008-10-06 09:14:24 +0400
committerShawn O. Pearce <spearce@spearce.org>2008-10-06 12:19:14 +0400
commitd70b4a8f4ba79fb83dc95e9483f9fb3feaf578b7 (patch)
tree56208dadfbdd238a76b6a7c254900ef7fc9a0f86 /git-rebase--interactive.sh
parent00e5d48a9aef3228496d6f517a272fa095c562fe (diff)
Teach rebase -i to honor pre-rebase hook
The original git-rebase honored pre-rebase hook so that public branches can be protected from getting rebased, but rebase --interactive ignored the hook entirely. This fixes it. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index edb6ec6ed0..3350f90cb1 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -65,6 +65,16 @@ output () {
esac
}
+run_pre_rebase_hook () {
+ 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
+}
+
require_clean_work_tree () {
# test if working tree is dirty
git rev-parse --verify HEAD > /dev/null &&
@@ -507,6 +517,7 @@ first and then run 'git rebase --continue' again."
;;
--)
shift
+ run_pre_rebase_hook ${1+"$@"}
test $# -eq 1 -o $# -eq 2 || usage
test -d "$DOTEST" &&
die "Interactive rebase already started"