{"version":"2.1.274","anchor":"git-worktree-safety-vetting-relative-gitdir-path-check-rewo","canonical_anchor":"git-worktree-safety-vetting-relative-gitdir-path-check-rewo","heading":"Git-worktree safety vetting: relative gitdir path check reworked","tier":"notice","area":"Git Worktrees","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.274\/e\/git-worktree-safety-vetting-relative-gitdir-path-check-rewo","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.274","markdown":"### Git-worktree safety vetting: relative gitdir path check reworked\n\nWorktree safety check for the 'gitdir' pointer file was reworked to correctly detect unsafe relative paths\n\n**What**\n\nThe routine that validates a worktree's `gitdir` pointer file, used to decide whether it's safe to treat as a real git directory, now normalizes the path relative to the repository's common directory before checking it for `..` or `.` segments. This replaces a previous check that appeared buggy, since it searched the wrong variable (`r`) instead of the freshly-split path.\n\n**Why**\n\nThis fixes a worktree safety check so that suspicious relative paths in a `gitdir` file (the kind git itself would not normally write) are properly detected, reducing the chance of treating an unsafe location as a legitimate git directory.\n\n- Area: Git Worktrees\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 1\/5"}