Skip to content

Commit

Permalink
rebase -i: remove unnecessary state rebase-root
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Martin von Zweigbergk authored and Junio C Hamano committed Feb 10, 2011
1 parent c6f7de5 commit c71f8f3
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ pick_one () {
output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1"
test -d "$rewritten" &&
pick_one_preserving_merges "$@" && return
if test -n "$rebase_root"
then
output git cherry-pick "$@"
return
fi
output git cherry-pick $ff "$@"
}

Expand Down Expand Up @@ -582,10 +577,6 @@ skip_unnecessary_picks () {
die "Could not skip unnecessary pick commands"
}

get_saved_options () {
test -f "$state_dir"/rebase-root && rebase_root=t
}

# Rearrange the todo list that has both "pick sha1 msg" and
# "pick sha1 fixup!/squash! msg" appears in it so that the latter
# comes immediately after the former, and change "pick" to
Expand Down Expand Up @@ -649,8 +640,6 @@ rearrange_squash () {

case "$action" in
continue)
get_saved_options

# do we have anything to commit?
if git diff-index --cached --quiet --ignore-submodules HEAD --
then
Expand Down Expand Up @@ -681,8 +670,6 @@ first and then run 'git rebase --continue' again."
do_rest
;;
skip)
get_saved_options

git rerere clear

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

: > "$state_dir"/interactive || die "Could not mark as interactive"
write_basic_state
case "$rebase_root" in
'')
rm -f "$state_dir"/rebase-root ;;
*)
: >"$state_dir"/rebase-root ;;
esac
if test t = "$preserve_merges"
then
if test -z "$rebase_root"
Expand Down

0 comments on commit c71f8f3

Please sign in to comment.