The --skip case was handled properly when rebasing without --merge, but the --continue case was not. Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- On Mon, 12 Nov 2007, Johannes Schindelin wrote: > On Mon, 12 Nov 2007, Pierre Habouzit wrote: > > > On Mon, Nov 12, 2007 at 12:21:34PM +0000, Johannes Schindelin > > wrote: > > > > > On Sun, 11 Nov 2007, Junio C Hamano wrote: > > > > > > > * js/rebase-detached (Thu Nov 8 18:19:08 2007 +0000) 1 commit > > > > + rebase: operate on a detached HEAD > > > > > > Note: this might have a subtle bug when the last patch in > > > the series failed. If I was not too tired this morning > > > (which might well have been the case), rebase could not > > > switch back to the branch correctly with this. > > > > OOOH so this was what happened to me today then. I did a > > rebase, there was a commit to skip, the last one, and I ended > > up on a detached head. As I didn't had my coffee yet, I > > assumed this was my fault and did something stupid. So after > > all it seems it wasn't the case then :) > > Thanks for acknowleding, and sorry for the bug. > > Will work on a fix, Here you are. Sorry again. git-rebase.sh | 6 +++++- t/t3403-rebase-skip.sh | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletions(-) diff --git a/git-rebase.sh b/git-rebase.sh index 7a45e27..c9034b8 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -171,7 +171,11 @@ do finish_rb_merge exit fi - git am --resolved --3way --resolvemsg="$RESOLVEMSG" + head_name=$(cat .dotest/head-name) && + onto=$(cat .dotest/onto) && + orig_head=$(cat .dotest/orig-head) && + git am --resolved --3way --resolvemsg="$RESOLVEMSG" && + move_to_original_branch exit ;; --skip) diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh index becabfc..657f681 100755 --- a/t/t3403-rebase-skip.sh +++ b/t/t3403-rebase-skip.sh @@ -38,6 +38,19 @@ test_expect_failure 'rebase with git am -3 (default)' ' test_expect_success 'rebase --skip with am -3' ' git rebase --skip ' + +test_expect_success 'rebase moves back to skip-reference' ' + test refs/heads/skip-reference = $(git symbolic-ref HEAD) && + git branch post-rebase && + git reset --hard pre-rebase && + ! git rebase master && + echo "hello" > hello && + git add hello && + git rebase --continue && + test refs/heads/skip-reference = $(git symbolic-ref HEAD) && + git reset --hard post-rebase +' + test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge' test_expect_failure 'rebase with --merge' 'git rebase --merge master' @@ -49,6 +62,10 @@ test_expect_success 'rebase --skip with --merge' ' test_expect_success 'merge and reference trees equal' \ 'test -z "`git diff-tree skip-merge skip-reference`"' +test_expect_success 'moved back to branch correctly' ' + test refs/heads/skip-merge = $(git symbolic-ref HEAD) +' + test_debug 'gitk --all & sleep 1' test_done -- 1.5.3.5.1738.g5c070 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html