[BUG] git diff --unified=0 / -U0 triggers a permission prompt despite being read-only

Status Open
Reported on v2.1.261
Maintainer reply None cached
Activity 0 comments · opened Sep 6, 2026

Preflight Checklist

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

What's Wrong?

With no Bash permission rules configured, git diff is auto-approved as read-only, but adding a context-count flag escalates it to a prompt.

Prompts:

git diff --cached -U0 <path>
git diff --cached --unified=0 <path>

Does not prompt:

git diff --cached <path>

-U<n> / --unified=<n> only controls how many context lines are printed around each hunk. It has no side effects — it cannot write to the worktree or index, and doesn't change which command runs. It looks like an unconditionally safe formatting flag that the read-only classifier doesn't recognize.

Env: Claude Code VS Code extension 2.1.261, Windows 11, no permissions block in user or project settings.

What Should Happen?

git diff -U<n> should be whitelisted similarly to git diff

Error Messages/Logs

Steps to Reproduce

Ask claude to run git diff and git diff -U0 from a chat tab in VS Code, and observe how only the latter prompts for permission.

Claude Model

_No response_

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.261 (VS Code extension)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗