summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2018-11-07 06:00:50 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-11-08 10:16:38 +0900
commit176f5d965ba128f79a51d6c8d1620506672403e1 (patch)
tree90c11373fb4e7bd39f062040119f7e43fb993aa2 /builtin
parentbuilt-in rebase: demonstrate regression with --autostash (diff)
downloadtgif-176f5d965ba128f79a51d6c8d1620506672403e1.tar.xz
built-in rebase --autostash: leave the current branch alone if possible
When we converted a `git reset --hard` call in the original Unix shell script to built-in code, we asked to reset the worktree and the index and explicitly *not* to detach the HEAD. By mistake, though, we still did. Let's fix this. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/rebase.c3
1 files changed, 2 insertions, 1 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);