repository: repo_submodule_init to take a submodule struct
[gitweb.git] / git-legacy-rebase.sh
index 5d92648014a41208617692a0d18d65db851d4717..b4c7dbfa575d3b5c664677c22b8613284d2e33fb 100755 (executable)
@@ -135,26 +135,63 @@ finish_rebase () {
        rm -rf "$state_dir"
 }
 
+run_interactive () {
+       GIT_CHERRY_PICK_HELP="$resolvemsg"
+       export GIT_CHERRY_PICK_HELP
+
+       test -n "$keep_empty" && keep_empty="--keep-empty"
+       test -n "$rebase_merges" && rebase_merges="--rebase-merges"
+       test -n "$rebase_cousins" && rebase_cousins="--rebase-cousins"
+       test -n "$autosquash" && autosquash="--autosquash"
+       test -n "$verbose" && verbose="--verbose"
+       test -n "$force_rebase" && force_rebase="--no-ff"
+       test -n "$restrict_revision" && \
+               restrict_revision="--restrict-revision=^$restrict_revision"
+       test -n "$upstream" && upstream="--upstream=$upstream"
+       test -n "$onto" && onto="--onto=$onto"
+       test -n "$squash_onto" && squash_onto="--squash-onto=$squash_onto"
+       test -n "$onto_name" && onto_name="--onto-name=$onto_name"
+       test -n "$head_name" && head_name="--head-name=$head_name"
+       test -n "$strategy" && strategy="--strategy=$strategy"
+       test -n "$strategy_opts" && strategy_opts="--strategy-opts=$strategy_opts"
+       test -n "$switch_to" && switch_to="--switch-to=$switch_to"
+       test -n "$cmd" && cmd="--cmd=$cmd"
+       test -n "$action" && action="--$action"
+
+       exec git rebase--interactive "$action" "$keep_empty" "$rebase_merges" "$rebase_cousins" \
+               "$upstream" "$onto" "$squash_onto" "$restrict_revision" \
+               "$allow_empty_message" "$autosquash" "$verbose" \
+               "$force_rebase" "$onto_name" "$head_name" "$strategy" \
+               "$strategy_opts" "$cmd" "$switch_to" \
+               "$allow_rerere_autoupdate" "$gpg_sign_opt" "$signoff"
+}
+
 run_specific_rebase () {
        if [ "$interactive_rebase" = implied ]; then
                GIT_EDITOR=:
                export GIT_EDITOR
                autosquash=
        fi
-       . git-rebase--$type
 
-       if test -z "$preserve_merges"
+       if test -n "$interactive_rebase" -a -z "$preserve_merges"
        then
-               git_rebase__$type
+               run_interactive
        else
-               git_rebase__preserve_merges
+               . git-rebase--$type
+
+               if test -z "$preserve_merges"
+               then
+                       git_rebase__$type
+               else
+                       git_rebase__preserve_merges
+               fi
        fi
 
        ret=$?
        if test $ret -eq 0
        then
                finish_rebase
-       elif test $ret -eq 2 # special exit status for rebase -i
+       elif test $ret -eq 2 # special exit status for rebase -p
        then
                apply_autostash &&
                rm -rf "$state_dir" &&
@@ -300,6 +337,11 @@ do
                fix|strip)
                        force_rebase=t
                        ;;
+               warn|nowarn|error|error-all)
+                       ;; # okay, known whitespace option
+               *)
+                       die "fatal: Invalid whitespace option: '${1#*=}'"
+                       ;;
                esac
                ;;
        --ignore-whitespace)
@@ -315,6 +357,9 @@ do
                git_am_opt="$git_am_opt $1"
                force_rebase=t
                ;;
+       -C*[!0-9]*)
+               die "fatal: switch \`C' expects a numerical value"
+               ;;
        -C*)
                git_am_opt="$git_am_opt $1"
                ;;
@@ -673,10 +718,16 @@ if test -n "$diffstat"
 then
        if test -n "$verbose"
        then
-               echo "$(eval_gettext "Changes from \$mb to \$onto:")"
+               if test -z "$mb"
+               then
+                       echo "$(eval_gettext "Changes to \$onto:")"
+               else
+                       echo "$(eval_gettext "Changes from \$mb to \$onto:")"
+               fi
        fi
+       mb_tree="${mb:-$(git hash-object -t tree /dev/null)}"
        # We want color (if set), but no pager
-       GIT_PAGER='' git diff --stat --summary "$mb" "$onto"
+       GIT_PAGER='' git diff --stat --summary "$mb_tree" "$onto"
 fi
 
 test -n "$interactive_rebase" && run_specific_rebase