LF='
'
ok_to_skip_pre_rebase=
-resolvemsg="
-$(gettext 'Resolve all conflicts manually, mark them as resolved with
-"git add/rm <conflicted_files>", then run "git rebase --continue".
-You can instead skip this commit: run "git rebase --skip".
-To abort and get back to the state before "git rebase", run "git rebase --abort".')
-"
+
squash_onto=
unset onto
unset restrict_revision
true) gpg_sign_opt=-S ;;
*) gpg_sign_opt= ;;
esac
+. git-rebase--common
read_basic_state () {
test -f "$state_dir/head-name" &&
}
}
-write_basic_state () {
- echo "$head_name" > "$state_dir"/head-name &&
- echo "$onto" > "$state_dir"/onto &&
- echo "$orig_head" > "$state_dir"/orig-head &&
- echo "$GIT_QUIET" > "$state_dir"/quiet &&
- test t = "$verbose" && : > "$state_dir"/verbose
- test -n "$strategy" && echo "$strategy" > "$state_dir"/strategy
- test -n "$strategy_opts" && echo "$strategy_opts" > \
- "$state_dir"/strategy_opts
- test -n "$allow_rerere_autoupdate" && echo "$allow_rerere_autoupdate" > \
- "$state_dir"/allow_rerere_autoupdate
- test -n "$gpg_sign_opt" && echo "$gpg_sign_opt" > "$state_dir"/gpg_sign_opt
- test -n "$signoff" && echo "$signoff" >"$state_dir"/signoff
-}
-
-output () {
- case "$verbose" in
- '')
- output=$("$@" 2>&1 )
- status=$?
- test $status != 0 && printf "%s\n" "$output"
- return $status
- ;;
- *)
- "$@"
- ;;
- esac
-}
-
-move_to_original_branch () {
- case "$head_name" in
- refs/*)
- message="rebase finished: $head_name onto $onto"
- git update-ref -m "$message" \
- $head_name $(git rev-parse HEAD) $orig_head &&
- git symbolic-ref \
- -m "rebase finished: returning to $head_name" \
- HEAD $head_name ||
- die "$(eval_gettext "Could not move back to \$head_name")"
- ;;
- esac
-}
-
-apply_autostash () {
- if test -f "$state_dir/autostash"
- then
- stash_sha1=$(cat "$state_dir/autostash")
- if git stash apply $stash_sha1 >/dev/null 2>&1
- then
- echo "$(gettext 'Applied autostash.')" >&2
- else
- git stash store -m "autostash" -q $stash_sha1 ||
- die "$(eval_gettext "Cannot store \$stash_sha1")"
- gettext 'Applying autostash resulted in conflicts.
-Your changes are safe in the stash.
-You can run "git stash pop" or "git stash drop" at any time.
-' >&2
- fi
- fi
-}
-
finish_rebase () {
rm -f "$(git rev-parse --git-path REBASE_HEAD)"
apply_autostash &&
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" &&
fix|strip)
force_rebase=t
;;
+ warn|nowarn|error|error-all)
+ ;; # okay, known whitespace option
+ *)
+ die "fatal: Invalid whitespace option: '${1#*=}'"
+ ;;
esac
;;
--ignore-whitespace)
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"
;;
# Note: incompatibility with --interactive is just a strong warning;
# git-rebase.txt caveats with "unless you know what you are doing"
test -n "$rebase_merges" &&
- die "$(gettext "error: cannot combine '--preserve_merges' with '--rebase-merges'")"
+ die "$(gettext "error: cannot combine '--preserve-merges' with '--rebase-merges'")"
fi
if test -n "$rebase_merges"
then
test -n "$strategy_opts" &&
- die "$(gettext "error: cannot combine '--rebase_merges' with '--strategy-option'")"
+ die "$(gettext "error: cannot combine '--rebase-merges' with '--strategy-option'")"
test -n "$strategy" &&
- die "$(gettext "error: cannot combine '--rebase_merges' with '--strategy'")"
+ die "$(gettext "error: cannot combine '--rebase-merges' with '--strategy'")"
fi
if test -z "$rebase_root"
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