Merge branch 'js/rebase-autostash-detach-fix'

"git rebase --autostash" did not correctly re-attach the HEAD at times.

* js/rebase-autostash-detach-fix:
  built-in rebase --autostash: leave the current branch alone if possible
  built-in rebase: demonstrate regression with --autostash
This commit is contained in:
Junio C Hamano
2018-11-18 18:23:55 +09:00
2 changed files with 10 additions and 1 deletions

View File

@ -613,7 +613,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);