diff options
author | Nanako Shiraishi <nanako3@lavabit.com> | 2008-10-06 14:14:24 +0900 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2008-10-06 01:19:14 -0700 |
commit | d70b4a8f4ba79fb83dc95e9483f9fb3feaf578b7 (patch) | |
tree | 56208dadfbdd238a76b6a7c254900ef7fc9a0f86 /git-rebase--interactive.sh | |
parent | 00e5d48a9aef3228496d6f517a272fa095c562fe (diff) | |
download | git-d70b4a8f4ba79fb83dc95e9483f9fb3feaf578b7.tar.gz |
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-x | git-rebase--interactive.sh | 11 |
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" |