From e24fde6bf14e5fc43efd6a3a54383a35d5840358 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Fri, 10 May 2024 10:46:34 -0400 Subject: [PATCH] fixup! reset: fix mixed reset when using virtual filesystem This should fix #490, at least in the case that I've been able to verify. The issue is that reset was setting the skip-worktree bit more frequently than it should have. The previous fix in #494 was focused on the case where a file is added or removed across the diff. However, when the file exists on both sides but still needs to be staged in a mixed reset then we should avoid the skip-worktree bit. Signed-off-by: Derrick Stolee --- builtin/reset.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin/reset.c b/builtin/reset.c index 9b9a3019cd6ea9..e066455535b587 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -182,7 +182,9 @@ static void update_index_from_diff(struct diff_queue_struct *q, */ if (core_virtualfilesystem && !file_exists(two->path)) { + respect_skip_worktree = 0; pos = index_name_pos(&the_index, two->path, strlen(two->path)); + if ((pos >= 0 && ce_skip_worktree(the_index.cache[pos])) && (is_missing || !was_missing)) { @@ -197,7 +199,6 @@ static void update_index_from_diff(struct diff_queue_struct *q, two->path); checkout_entry(ceBefore, &state, NULL, NULL); - respect_skip_worktree = 0; } }