@@ -118,7 +118,7 @@ read_basic_state () {
118118 else
119119 orig_head=$( cat " $state_dir " /head)
120120 fi &&
121- GIT_QUIET= $( cat " $state_dir " /quiet) &&
121+ test -f " $state_dir " /quiet && GIT_QUIET=t
122122 test -f " $state_dir " /verbose && verbose=t
123123 test -f " $state_dir " /strategy && strategy=" $( cat " $state_dir " /strategy) "
124124 test -f " $state_dir " /strategy_opts &&
@@ -226,17 +226,15 @@ then
226226 state_dir=" $apply_dir "
227227elif test -d " $merge_dir "
228228then
229+ type=interactive
229230 if test -d " $merge_dir " /rewritten
230231 then
231232 type=preserve-merges
232233 interactive_rebase=explicit
233234 preserve_merges=t
234235 elif test -f " $merge_dir " /interactive
235236 then
236- type=interactive
237237 interactive_rebase=explicit
238- else
239- type=merge
240238 fi
241239 state_dir=" $merge_dir "
242240fi
496494 test -z " $interactive_rebase " && interactive_rebase=implied
497495fi
498496
497+ actually_interactive=
499498if test -n " $interactive_rebase "
500499then
501500 if test -z " $preserve_merges "
@@ -504,11 +503,12 @@ then
504503 else
505504 type=preserve-merges
506505 fi
507-
506+ actually_interactive=t
508507 state_dir=" $merge_dir "
509508elif test -n " $do_merge "
510509then
511- type=merge
510+ interactive_rebase=implied
511+ type=interactive
512512 state_dir=" $merge_dir "
513513else
514514 type=am
@@ -520,28 +520,20 @@ then
520520 git_format_patch_opt=" $git_format_patch_opt --progress"
521521fi
522522
523- if test -n " $git_am_opt " ; then
524- incompatible_opts=$( echo " $git_am_opt " | \
525- sed -e ' s/ -q / /g' -e ' s/^ \(.*\) $/\1/' )
526- if test -n " $interactive_rebase "
523+ incompatible_opts=$( echo " $git_am_opt " | \
524+ sed -e ' s/ -q / /g' -e ' s/^ \(.*\) $/\1/' )
525+ if test -n " $incompatible_opts "
526+ then
527+ if test -n " $actually_interactive " || test " $do_merge "
527528 then
528- if test -n " $incompatible_opts "
529- then
530- die " $( gettext " error: cannot combine interactive options (--interactive, --exec, --rebase-merges, --preserve-merges, --keep-empty, --root + --onto) with am options ($incompatible_opts )" ) "
531- fi
532- fi
533- if test -n " $do_merge " ; then
534- if test -n " $incompatible_opts "
535- then
536- die " $( gettext " error: cannot combine merge options (--merge, --strategy, --strategy-option) with am options ($incompatible_opts )" ) "
537- fi
529+ die " $( gettext " fatal: cannot combine am options with either interactive or merge options" ) "
538530 fi
539531fi
540532
541533if test -n " $signoff "
542534then
543535 test -n " $preserve_merges " &&
544- die " $( gettext " error : cannot combine '--signoff' with '--preserve-merges'" ) "
536+ die " $( gettext " fatal : cannot combine '--signoff' with '--preserve-merges'" ) "
545537 git_am_opt=" $git_am_opt $signoff "
546538 force_rebase=t
547539fi
552544 # Note: incompatibility with --interactive is just a strong warning;
553545 # git-rebase.txt caveats with "unless you know what you are doing"
554546 test -n " $rebase_merges " &&
555- die " $( gettext " error : cannot combine '--preserve-merges' with '--rebase-merges'" ) "
547+ die " $( gettext " fatal : cannot combine '--preserve-merges' with '--rebase-merges'" ) "
556548
557549 test -n " $reschedule_failed_exec " &&
558550 die " $( gettext " error: cannot combine '--preserve-merges' with '--reschedule-failed-exec'" ) "
561553if test -n " $rebase_merges "
562554then
563555 test -n " $strategy_opts " &&
564- die " $( gettext " error : cannot combine '--rebase-merges' with '--strategy-option'" ) "
556+ die " $( gettext " fatal : cannot combine '--rebase-merges' with '--strategy-option'" ) "
565557 test -n " $strategy " &&
566- die " $( gettext " error : cannot combine '--rebase-merges' with '--strategy'" ) "
558+ die " $( gettext " fatal : cannot combine '--rebase-merges' with '--strategy'" ) "
567559fi
568560
569561if test -z " $rebase_root "
@@ -702,7 +694,7 @@ require_clean_work_tree "rebase" "$(gettext "Please commit or stash them.")"
702694# but this should be done only when upstream and onto are the same
703695# and if this is not an interactive rebase.
704696mb=$( git merge-base " $onto " " $orig_head " )
705- if test -z " $interactive_rebase " && test " $upstream " = " $onto " &&
697+ if test -z " $actually_interactive " && test " $upstream " = " $onto " &&
706698 test " $mb " = " $onto " && test -z " $restrict_revision " &&
707699 # linear history?
708700 ! (git rev-list --parents " $onto " .." $orig_head " | sane_grep " .* " ) > /dev/null
@@ -752,6 +744,19 @@ then
752744 GIT_PAGER=' ' git diff --stat --summary " $mb_tree " " $onto "
753745fi
754746
747+ if test -z " $actually_interactive " && test " $mb " = " $orig_head "
748+ then
749+ say " $( eval_gettext " Fast-forwarded \$ branch_name to \$ onto_name." ) "
750+ GIT_REFLOG_ACTION=" $GIT_REFLOG_ACTION : checkout $onto_name " \
751+ git checkout -q " $onto ^0" || die " could not detach HEAD"
752+ # If the $onto is a proper descendant of the tip of the branch, then
753+ # we just fast-forwarded.
754+ git update-ref ORIG_HEAD $orig_head
755+ move_to_original_branch
756+ finish_rebase
757+ exit 0
758+ fi
759+
755760test -n " $interactive_rebase " && run_specific_rebase
756761
757762# Detach HEAD and reset the tree
@@ -761,16 +766,6 @@ GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name" \
761766 git checkout -q " $onto ^0" || die " could not detach HEAD"
762767git update-ref ORIG_HEAD $orig_head
763768
764- # If the $onto is a proper descendant of the tip of the branch, then
765- # we just fast-forwarded.
766- if test " $mb " = " $orig_head "
767- then
768- say " $( eval_gettext " Fast-forwarded \$ branch_name to \$ onto_name." ) "
769- move_to_original_branch
770- finish_rebase
771- exit 0
772- fi
773-
774769if test -n " $rebase_root "
775770then
776771 revisions=" $onto ..$orig_head "
0 commit comments