author | Junio C Hamano <junkio@cox.net> | |
Sat, 18 Feb 2006 09:24:01 +0000 (01:24 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sat, 18 Feb 2006 09:24:01 +0000 (01:24 -0800) |
* jc/rebase-limit:
rebase: allow rebasing onto different base.
rebase: allow rebasing onto different base.
1 | 2 | |||
---|---|---|---|---|
git-rebase.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc git-rebase.sh
index f84160d32456820765e5b4f899a2fdd0aa5bf9cd,a2651be1fe0bcbb8b615c2def86561ed91547093..21c3d83c3ade9bfb0cdabb00928eab4606062c1a
--- 1/git-rebase.sh
--- 2/git-rebase.sh
+++ b/git-rebase.sh
;;
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)