[PATCH 31/31] rebase -i: remove unnecessary state rebase-root
From: Martin von Zweigbergk <hidden>
Date: 2016-06-15 22:50:18
Subsystem:
the rest · Maintainer:
Linus Torvalds
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 <redacted> --- While factoring out the state writing code a few patches back, I went through each of the pieces of state that was written. I was a bit hesitant to include this patch since I'm not quite sure why the code was introduced, but I thought I would include it anyway to hear what you have to say. There used to be bug when using --ff when rebasing a root commit. This was fixed in 6355e50 (builtin/revert.c: don't dereference a NULL pointer, 2010-09-27). Could this have been the reason for the check? Thomas, do you remember? git-rebase--interactive.sh | 15 --------------- 1 files changed, 0 insertions(+), 15 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index d20a9b2..a9f44d8 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh@@ -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 "$@" }
@@ -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
@@ -701,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"
--
1.7.3.2.864.gbbb96