[PATCH 02/11] reset_head(): fix checkout
- From
- Phillip Wood via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Oct 1, 2021, 10:04 UTC
- Message-ID
- <c8f641132160d6bbd72a5e4921f1c9f0b3d40242.1633082702.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1049.git.1633082702.gitgitgadget@gmail.com>
From: Phillip Wood <phillip.wood@dunelm.org.uk>
The reset bit should only be set if flags contains RESET_HEAD_HARD. The test for `!deatch_head` dates back to the original implementation of reset_head() in ac7f467fef ("builtin/rebase: support running "git rebase <upstream>"", 2018-08-07) and was correct until e65123a71d ("builtin rebase: support `git rebase <upstream> <switch-to>`", 2018-09-04) started using reset_head() to checkout <switch-to> when fast-forwarding.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> --- reset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/reset.c b/reset.c index 79310ae071b..fc4dae3fd2d 100644 --- a/reset.c +++ b/reset.c @@ -57,7 +57,7 @@ int reset_head(struct repository *r, struct object_id *oid, const char *action, unpack_tree_opts.update = 1; unpack_tree_opts.merge = 1; init_checkout_metadata(&unpack_tree_opts.meta, switch_to_branch, oid, NULL); - if (!detach_head) + if (reset_hard) unpack_tree_opts.reset = 1; if (repo_read_index_unmerged(r) < 0) {
-- gitgitgadget