worktree remove: use gvfs_config_is_set for skip-clean-check gate#875
worktree remove: use gvfs_config_is_set for skip-clean-check gate#875tyrielv wants to merge 1 commit intomicrosoft:vfs-2.53.0from
Conversation
dscho
left a comment
There was a problem hiding this comment.
Good rationale.
A request going forward: Could you add an Assisted-by: Claude Opus 4.6 and your Signed-off-by: trailer, and drop that Co-authored-by: <bogus-email> trailer in your commit messages, please?
Also: I wonder whether any other bare core_virtualfilesystems need the same treatment?
I guess that the |
Acknowledged
Anywhere it's used as a flag, it probably should be changed (since I think we've long given up on making the contributions generic enough that a different virtual filesystem could be used than VFSForGit). The content of core_virtualfilesystem is a hook to call to get the list of modified files tracked by the vfs, so when it's used as that hook it would stay as-is. I'll work on that. |
e3e19e3 to
778fea4
Compare
Every other place This location should definitely use gvfs_config_is_set - but now I think it should use the new GVFS_SUPPORT_WORKTREES bit instead of GVFS_USE_VIRTUAL_FILESYSTEM to be clearer. |
The skip-clean-check guard in remove_worktree() was gated on core_virtualfilesystem, which is only initialized by repo_config_get_virtualfilesystem() during index loading. Since the worktree remove path never loads the index before this check, the variable was always NULL, causing check_clean_worktree() to run even when VFSForGit had already unmounted the projection and written the skip-clean-check marker file. This made 'git worktree remove' fail with 'fatal: failed to run git status' in GVFS repos. Replace core_virtualfilesystem with gvfs_config_is_set(GVFS_SUPPORTS_WORKTREES). This is the correct bit to check here: remove_worktree() can only be reached when GVFS_SUPPORTS_WORKTREES is set (cmd_worktree blocks otherwise at line 1501), and it directly expresses that the VFS layer supports worktree operations and knows how to signal when a clean check can be skipped. Unlike core_virtualfilesystem, gvfs_config_is_set() is self-loading from core.gvfs and does not depend on the index having been read. Assisted-by: Claude Opus 4.6 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
778fea4 to
6c886e2
Compare
mjcheetham
left a comment
There was a problem hiding this comment.
Given the use of core_virtualfilesystem in every other place in the codebase, and the issue this caused here, maybe it's worth just a small comment in the code about why we're calling gvfs_config_is_set instead. Future readers may wonder why not just use core_virtualfileystem.
Approving to not block.
The skip-clean-check guard in remove_worktree() was gated on core_virtualfilesystem, which is only initialized by repo_config_get_virtualfilesystem() during index loading. Since the worktree remove path never loads the index before this check, the variable was always NULL, causing check_clean_worktree() to run even when VFSForGit had already unmounted the projection and written the skip-clean-check marker file. This made 'git worktree remove' fail with 'fatal: failed to run git status' in GVFS repos.
Replace core_virtualfilesystem with gvfs_config_is_set(GVFS_USE_VIRTUAL_FILESYSTEM), which is already loaded from core.gvfs by cmd_worktree() before dispatch to remove_worktree().