From: Junio C Hamano Date: Wed, 15 Feb 2006 01:56:48 +0000 (-0800) Subject: Merge branch 'jc/rebase-limit' X-Git-Tag: v1.3.0-rc1~54^2~71 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=cfba73c842105a0fc3ae9e6a7728bdb64d1a8215;p=git.git Merge branch 'jc/rebase-limit' * jc/rebase-limit: rebase: allow rebasing onto different base. --- cfba73c842105a0fc3ae9e6a7728bdb64d1a8215 diff --cc git-rebase.sh index f84160d3,a2651be1..21c3d83c --- a/git-rebase.sh +++ b/git-rebase.sh @@@ -30,21 -68,11 +68,20 @@@ case "$diff" i ;; esac - # The other head is given. Make sure it is valid. - 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 + # The upstream head must be given. Make sure it is valid. + upstream_name="$1" + upstream=`git rev-parse --verify "${upstream_name}^0"` || + die "invalid upsteram $upstream_name" +# 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)