[BUG] .worktreeinclude silently skips files with non-ASCII characters in their name

Open 💬 0 comments Opened Jun 9, 2026 by aunitt

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code (2.1.170)

What's Wrong?

When Claude Code creates a worktree, .worktreeinclude copies matching gitignored files into the new worktree — but it silently skips any file whose name contains non-ASCII characters (e.g. Douša.md, café.txt, CJK names). No error or warning is shown; the file is simply absent from the worktree. ASCII-named files matched by the same pattern are copied correctly.

What Should Happen?

All gitignored files matching a .worktreeinclude pattern should be copied into the worktree, regardless of whether their names contain non-ASCII characters.

Error Messages/Logs

No error output — the skip is silent, which is part of what makes it hard to notice (a worktree appears correctly populated but is quietly missing files).

Steps to Reproduce

Verified on macOS, Claude Code 2.1.170.

  1. In a git repo, gitignore a directory and add a glob to .worktreeinclude:

```
# .gitignore
output/

# .worktreeinclude
output/*.md
```

  1. Create two matching files:

``bash
echo a > output/ascii.md
echo b > output/Douša.md # non-ASCII: š = U+0161
``

Both are confirmed gitignored and matched (git check-ignore -q output/Douša.md exits 0).

  1. Create a worktree (claude --worktree, or the EnterWorktree tool).
  2. Result in the worktree: output/ascii.md is present; output/Douša.md is missing.

Likely cause (hypothesis — I can't see the harness source)

The copy step appears to enumerate gitignored files via git with git's default core.quotePath=true, which returns non-ASCII paths C-quoted with octal escapes:

$ git ls-files --others --ignored --exclude-standard -- 'output/*.md'
"output/Dou\305\241a.md"        # default (quotePath=true)

$ git -c core.quotepath=false ls-files --others --ignored --exclude-standard -- 'output/*.md'
output/Douša.md                 # raw UTF-8

The quoted literal (output/Dou\305\241a.md) matches no real file on disk, so the copy silently skips it. The filename is stored as NFC (single codepoint U+0161), so this is not an NFC/NFD normalisation issue.

Suggested fix

  • Enumerate files to copy with -c core.quotepath=false (or use -z / NUL-delimited output and read raw bytes), and/or unquote git's C-style quoted paths before copying.
  • Log a warning when a pattern-matched file can't be copied, so the skip isn't silent.

Claude Model

N/A — this is CLI/filesystem behaviour in the worktree bootstrap, independent of the model.

Is this a regression?

I don't know.

Claude Code Version

2.1.170 (Claude Code)

Platform

Anthropic API

Operating System

macOS (26.5, arm64)

Terminal/Shell

iTerm2 (zsh)

View original on GitHub ↗