Skip to content

Commit cbc41ac

Browse files
borisbatclaude
andcommitted
Platform-gate the main-checkout identity compare in worktree removal
Copilot on #3574: the guard lowercased both paths unconditionally while find_worktree ten lines up gates the case fold on Windows - on a case-sensitive filesystem, case-differing paths were wrongly equated and a legitimate deletion refused as "main". Same gate as the sibling now. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012kHBtxNVFeNDxBphkfUAzg
1 parent d41cf11 commit cbc41ac

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

utils/dasHerd/watcher/repository_core.das

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,13 @@ def public repository_remove_worktree(repository_id, worktree_path : string;
755755
}
756756
var runtime = g_repositories[repository_index]
757757
let checkout = runtime.snapshot.record.checkout_path
758-
if (to_lower(normalized_path(worktree_path)) == to_lower(normalized_path(checkout))) {
758+
// Case-insensitive only on Windows, matching find_worktree's platform
759+
// gate - a case-sensitive filesystem holds case-differing paths apart.
760+
let wanted_identity = (get_platform_name() == "windows"
761+
? to_lower(normalized_path(worktree_path)) : normalized_path(worktree_path))
762+
let checkout_identity = (get_platform_name() == "windows"
763+
? to_lower(normalized_path(checkout)) : normalized_path(checkout))
764+
if (wanted_identity == checkout_identity) {
759765
reason = "main"
760766
detail = "the main checkout cannot be deleted"
761767
return false

0 commit comments

Comments
 (0)