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 <martin.von.zweigbergk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin von Zweigbergk committed
Feb 6, 2011 at 13:44 UTC
c71f8f3d501b155c3efa6aea2bc7768f7ace8cd1
1 file changed
-19
git-rebase--interactive.sh
-19
@@ -168,11 +168,6 @@ pick_one () {
168
output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
169
test -d "$rewritten" &&
170
pick_one_preserving_merges "$@" && return
171
- if test -n "$rebase_root"
172
- then
173
- output git cherry-pick "$@"
174
- return
175
- fi
171
output git cherry-pick $ff "$@"
172
}
173
@@ -582,10 +577,6 @@ skip_unnecessary_picks () {
577
die "Could not skip unnecessary pick commands"
578
}
579
585
-get_saved_options () {
586
- test -f "$state_dir"/rebase-root && rebase_root=t
587
-}
588
-
580
# Rearrange the todo list that has both "pick sha1 msg" and
581
# "pick sha1 fixup!/squash! msg" appears in it so that the latter
582
# comes immediately after the former, and change "pick" to
@@ -649,8 +640,6 @@ rearrange_squash () {
640
641
case "$action" in
642
continue)
652
- get_saved_options
653
-
643
# do we have anything to commit?
644
if git diff-index --cached --quiet --ignore-submodules HEAD --
645
then
@@ -681,8 +670,6 @@ first and then run 'git rebase --continue' again."
670
do_rest
671
;;
672
skip)
684
- get_saved_options
685
-
673
git rerere clear
674
675
do_rest
@@ -705,12 +692,6 @@ mkdir "$state_dir" || die "Could not create temporary $state_dir"
692
693
: > "$state_dir"/interactive || die "Could not mark as interactive"
694
write_basic_state
708
-case "$rebase_root" in
709
-'')
710
- rm -f "$state_dir"/rebase-root ;;
711
-*)
712
- : >"$state_dir"/rebase-root ;;
713
-esac
695
if test t = "$preserve_merges"
696
then
697
if test -z "$rebase_root"