Re: [RFC] checkout --rebase
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jul 19, 2013, 11:33 UTC
- Message-ID
- <CALkWK0kVNw3Ko3+_Y-KDF=pdha6wxyMmQmLtOOr5tQYzgUr_Mw@mail.gmail.com>
- In-Reply-To
- <CALkWK0nM4fkCPNJo_c3Rpwh1azsGRdGvM3S80vcuRiRXDT0vOQ@mail.gmail.com>
Ramkumar Ramachandra wrote:
Show 6 quoted lines
> Sebastian Staudt wrote: >> Isn't this what you want? >> >> $ git rebase master um-build > > Ha, yes. Sorry about the stupidity.
Hm, I'm not entirely sure how to optimize the codepath to eliminate the checkout. It seems to be absolutely necessary atleast in the -i codepath.
Let's inspect when $switch_to is set:
# Is it "rebase other $branchname" or "rebase other $commit"? branch_name="$1" switch_to="$1"
$revisions seems to be set correctly, and rebase--am does a move_to_original_branch as the last step. So, I wonder if this will work:
diff --git a/git-rebase.sh b/git-rebase.sh index 0039ecf..7405d9a 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -542,9 +542,15 @@ then if test -z "$force_rebase" then # Lazily switch to the target branch if needed... - test -z "$switch_to" || - GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $switch_to" \ - git checkout "$switch_to" -- + if ! test -z "$switch_to"; then + if "$type" = am; then + GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout -b $switch_to-2" \ + git checkout -b "$switch_to-2" -- + else + GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $switch_to" \ + git checkout "$switch_to" -- + fi + fi say "$(eval_gettext "Current branch \$branch_name is up to date.")" finish_rebase exit 0 (ofcourse, we still need a mechanism to remove this temporary $switch_to-2 branch) What about rebase--merge? Can we eliminate the checkout then?