Skip to content

Commit c71f8f3

Browse files
Martin von Zweigbergkgitster
authored andcommitted
rebase -i: remove unnecessary state rebase-root
Before calling 'git cherry-pick', interactive rebase currently checks if we are rebasing from root (if --root was passed). If we are, the '--ff' flag to 'git cherry-pick' is omitted. However, according to the documentation for 'git cherry-pick --ff', "If the current HEAD is the same as the parent of the cherry-picked commit, then a fast forward to this commit will be performed.". This should never be the case when rebasing from root, so it should not matter whether --ff is passed, so simplify the code by removing the condition. Signed-off-by: Martin von Zweigbergk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c6f7de5 commit c71f8f3

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

git-rebase--interactive.sh

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,6 @@ pick_one () {
168168
output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
169169
test -d "$rewritten" &&
170170
pick_one_preserving_merges "$@" && return
171-
if test -n "$rebase_root"
172-
then
173-
output git cherry-pick "$@"
174-
return
175-
fi
176171
output git cherry-pick $ff "$@"
177172
}
178173

@@ -582,10 +577,6 @@ skip_unnecessary_picks () {
582577
die "Could not skip unnecessary pick commands"
583578
}
584579

585-
get_saved_options () {
586-
test -f "$state_dir"/rebase-root && rebase_root=t
587-
}
588-
589580
# Rearrange the todo list that has both "pick sha1 msg" and
590581
# "pick sha1 fixup!/squash! msg" appears in it so that the latter
591582
# comes immediately after the former, and change "pick" to
@@ -649,8 +640,6 @@ rearrange_squash () {
649640

650641
case "$action" in
651642
continue)
652-
get_saved_options
653-
654643
# do we have anything to commit?
655644
if git diff-index --cached --quiet --ignore-submodules HEAD --
656645
then
@@ -681,8 +670,6 @@ first and then run 'git rebase --continue' again."
681670
do_rest
682671
;;
683672
skip)
684-
get_saved_options
685-
686673
git rerere clear
687674

688675
do_rest
@@ -705,12 +692,6 @@ mkdir "$state_dir" || die "Could not create temporary $state_dir"
705692

706693
: > "$state_dir"/interactive || die "Could not mark as interactive"
707694
write_basic_state
708-
case "$rebase_root" in
709-
'')
710-
rm -f "$state_dir"/rebase-root ;;
711-
*)
712-
: >"$state_dir"/rebase-root ;;
713-
esac
714695
if test t = "$preserve_merges"
715696
then
716697
if test -z "$rebase_root"

0 commit comments

Comments
 (0)