Skip to content

Commit

Permalink
fixup! reset: fix mixed reset when using virtual filesystem
Browse files Browse the repository at this point in the history
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 <dstolee@microsoft.com>
  • Loading branch information
derrickstolee authored and dscho committed Jun 3, 2024
1 parent bc6cc5f commit e24fde6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin/reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand All @@ -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;
}
}

Expand Down

0 comments on commit e24fde6

Please sign in to comment.