From: Junio C Hamano Date: Thu, 5 Mar 2009 23:41:40 +0000 (-0800) Subject: Merge branch 'sr/force-rebase' X-Git-Tag: v1.6.3-rc0~211 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/e7cf1da70f1bbb477614547ca2874392c9d37862?ds=inline;hp=-c Merge branch 'sr/force-rebase' * sr/force-rebase: Teach rebase to rebase even if upstream is up to date --- e7cf1da70f1bbb477614547ca2874392c9d37862 diff --combined git-rebase.sh index 368c0ef434,5d9a393c38..c2a9b1fbe0 --- a/git-rebase.sh +++ b/git-rebase.sh @@@ -3,7 -3,7 +3,7 @@@ # Copyright (c) 2005 Junio C Hamano. # - USAGE='[--interactive | -i] [-v] [--onto ] [|--root] []' + USAGE='[--interactive | -i] [-v] [--force-rebase | -f] [--onto ] [|--root] []' LONG_USAGE='git-rebase replaces with a new branch of the same name. When the --onto option is provided the new branch starts out with a HEAD equal to , otherwise it is equal to @@@ -48,6 -48,7 +48,7 @@@ prec= verbose= git_am_opt= rebase_root= + force_rebase= continue_merge () { test -n "$prev_head" || die "prev_head must be defined" @@@ -294,6 -295,11 +295,11 @@@ d ;; --whitespace=*) git_am_opt="$git_am_opt $1" + case "$1" in + --whitespace=fix|--whitespace=strip) + force_rebase=t + ;; + esac ;; -C*) git_am_opt="$git_am_opt $1" @@@ -301,6 -307,9 +307,9 @@@ --root) rebase_root=t ;; + -f|--f|--fo|--for|--forc|force|--force-r|--force-re|--force-reb|--force-reba|--force_rebas|--force-rebase) + force_rebase=t + ;; -*) usage ;; @@@ -310,7 -319,6 +319,7 @@@ esac shift done +test $# -gt 2 && usage # Make sure we do not have $GIT_DIR/rebase-apply if test -z "$do_merge" @@@ -420,10 -428,15 +429,15 @@@ if test "$upstream" = "$onto" && test " # linear history? ! (git rev-list --parents "$onto".."$branch" | grep " .* ") > /dev/null then - # Lazily switch to the target branch if needed... - test -z "$switch_to" || git checkout "$switch_to" - echo >&2 "Current branch $branch_name is up to date." - exit 0 + if test -z "$force_rebase" + then + # Lazily switch to the target branch if needed... + test -z "$switch_to" || git checkout "$switch_to" + echo >&2 "Current branch $branch_name is up to date." + exit 0 + else + echo "Current branch $branch_name is up to date, rebase forced." + fi fi if test -n "$verbose"