@@ -961,100 +961,13 @@ git_rebase__interactive () {
961
961
setup_reflog_action
962
962
init_basic_state
963
963
964
- if test t = " $preserve_merges "
965
- then
966
- if test -z " $rebase_root "
967
- then
968
- mkdir " $rewritten " &&
969
- for c in $( git merge-base --all $orig_head $upstream )
970
- do
971
- echo $onto > " $rewritten " /$c ||
972
- die " $( gettext " Could not init rewritten commits" ) "
973
- done
974
- else
975
- mkdir " $rewritten " &&
976
- echo $onto > " $rewritten " /root ||
977
- die " $( gettext " Could not init rewritten commits" ) "
978
- fi
979
- # No cherry-pick because our first pass is to determine
980
- # parents to rewrite and skipping dropped commits would
981
- # prematurely end our probe
982
- merges_option=
983
- else
984
- merges_option=" --no-merges --cherry-pick"
985
- fi
964
+ merges_option=" --no-merges --cherry-pick"
986
965
987
966
init_revisions_and_shortrevisions
988
967
989
- if test t ! = " $preserve_merges "
990
- then
991
- git rebase--helper --make-script ${keep_empty: +--keep-empty} \
992
- $revisions ${restrict_revision+^$restrict_revision } > " $todo " ||
993
- die " $( gettext " Could not generate todo list" ) "
994
- else
995
- format=$( git config --get rebase.instructionFormat)
996
- # the 'rev-list .. | sed' requires %m to parse; the instruction requires %H to parse
997
- git rev-list $merges_option --format=" %m%H ${format:-% s} " \
998
- --reverse --left-right --topo-order \
999
- $revisions ${restrict_revision+^$restrict_revision } | \
1000
- sed -n " s/^>//p" |
1001
- while read -r sha1 rest
1002
- do
1003
-
1004
- if test -z " $keep_empty " && is_empty_commit $sha1 && ! is_merge_commit $sha1
1005
- then
1006
- comment_out=" $comment_char "
1007
- else
1008
- comment_out=
1009
- fi
1010
-
1011
- if test -z " $rebase_root "
1012
- then
1013
- preserve=t
1014
- for p in $( git rev-list --parents -1 $sha1 | cut -d' ' -s -f2-)
1015
- do
1016
- if test -f " $rewritten " /$p
1017
- then
1018
- preserve=f
1019
- fi
1020
- done
1021
- else
1022
- preserve=f
1023
- fi
1024
- if test f = " $preserve "
1025
- then
1026
- touch " $rewritten " /$sha1
1027
- printf ' %s\n' " ${comment_out} pick $sha1 $rest " >> " $todo "
1028
- fi
1029
- done
1030
- fi
1031
-
1032
- # Watch for commits that been dropped by --cherry-pick
1033
- if test t = " $preserve_merges "
1034
- then
1035
- mkdir " $dropped "
1036
- # Save all non-cherry-picked changes
1037
- git rev-list $revisions --left-right --cherry-pick | \
1038
- sed -n " s/^>//p" > " $state_dir " /not-cherry-picks
1039
- # Now all commits and note which ones are missing in
1040
- # not-cherry-picks and hence being dropped
1041
- git rev-list $revisions |
1042
- while read rev
1043
- do
1044
- if test -f " $rewritten " /$rev &&
1045
- ! sane_grep " $rev " " $state_dir " /not-cherry-picks > /dev/null
1046
- then
1047
- # Use -f2 because if rev-list is telling us this commit is
1048
- # not worthwhile, we don't want to track its multiple heads,
1049
- # just the history of its first-parent for others that will
1050
- # be rebasing on top of it
1051
- git rev-list --parents -1 $rev | cut -d' ' -s -f2 > " $dropped " /$rev
1052
- sha1=$( git rev-list -1 $rev )
1053
- sane_grep -v " ^[a-z][a-z]* $sha1 " < " $todo " > " ${todo} 2" ; mv " ${todo} 2" " $todo "
1054
- rm " $rewritten " /$rev
1055
- fi
1056
- done
1057
- fi
968
+ git rebase--helper --make-script ${keep_empty: +--keep-empty} \
969
+ $revisions ${restrict_revision+^$restrict_revision } > " $todo " ||
970
+ die " $( gettext " Could not generate todo list" ) "
1058
971
1059
972
complete_action
1060
973
}
0 commit comments