diff options
-rw-r--r-- | builtin/rebase.c | 3 | ||||
-rwxr-xr-x | t/t3420-rebase-autostash.sh | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c index bc92c9b529..d7239763c8 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -612,7 +612,8 @@ static int reset_head(struct object_id *oid, const char *action, reflog_head = msg.buf; } if (!switch_to_branch) - ret = update_ref(reflog_head, "HEAD", oid, orig, REF_NO_DEREF, + ret = update_ref(reflog_head, "HEAD", oid, orig, + detach_head ? REF_NO_DEREF : 0, UPDATE_REFS_MSG_ON_ERR); else { ret = create_symref("HEAD", switch_to_branch, msg.buf); diff --git a/t/t3420-rebase-autostash.sh b/t/t3420-rebase-autostash.sh index cc6149d53f..4e3d362d37 100755 --- a/t/t3420-rebase-autostash.sh +++ b/t/t3420-rebase-autostash.sh @@ -361,7 +361,7 @@ test_expect_success 'autostash with dirty submodules' ' git rebase -i --autostash HEAD ' -test_expect_failure 'branch is left alone when possible' ' +test_expect_success 'branch is left alone when possible' ' git checkout -b unchanged-branch && echo changed >file0 && git rebase --autostash unchanged-branch && |