Skip to content

Terminal auto-approval fails for git diff -- <path> despite "git diff" allow rule #321748

Description

  • Copilot Chat Extension Version:
  • VS Code Version: 1.123.2
  • OS Version: Win 11
  • Feature (e.g. agent/edit/ask mode): agent mode
  • Selected model: any, tested with GPT 5.5 and Opus 4.x

chat.tools.terminal.autoApprove does not auto-approve git diff -- <path>

Description

A chat.tools.terminal.autoApprove rule for git diff auto-approves git diff <path>, but the equivalent Git command using the pathspec separator, git diff -- <path>, still asks for approval.

Since plain auto-approve entries are converted to prefix matches, "git diff": true appears expected to match both forms. This looks like the terminal command parser may be splitting or classifying the bare -- form differently before rule matching.

Steps to Reproduce

  1. On Windows with PowerShell as the integrated terminal shell, enable terminal auto-approval.
  2. Add this setting:
"chat.tools.terminal.autoApprove": {
  "git diff": true
}
  1. In Copilot Chat agent mode, run:
git diff file.txt
  1. Observe that the command is auto-approved.
  2. In Copilot Chat agent mode, run:
git diff -- file.txt

Expected Behavior

git diff -- file.txt is auto-approved by the "git diff": true rule, the same as git diff file.txt.

Actual Behavior

git diff -- file.txt asks for approval.

Activity

  1. vs-code-engineering commented on Jun 17, 2026

    @vs-code-engineering
    Contributor

    Thanks for creating this issue! It looks like you may be using an old version of VS Code; the latest stable release is 1.124.2. Please try upgrading to the latest version and checking whether this issue remains.

    Happy Coding!

  2. stmax82 commented on Jun 22, 2026

    @stmax82
    Author

    Yes it still happens in 1.125.1.

  3. ckchessmaster commented on Jun 22, 2026

    @ckchessmaster

    I am also encountering this issue on 1.125.1
    I don't think it's isolated to just git diff either. I've encountered it with various other commands as well.

  4. grebdioZ commented on Aug 28, 2026

    @grebdioZ

    It happens to me all the time, and for ages, and still with the latest version 1.134.0.

    Does anyone know any workarounds other than blank auto-approve?

  5. iket0731 commented on Aug 31, 2026

    @iket0731

    I debugged this issue and found that tree-sitter-powershell fails to parse a bare -- token, producing a parse error (ERROR node).
    This looks like the same class of issue as #294010, and I believe it can be fixed the same way (masking the token before parsing).

  6. iket0731 commented on Sep 7, 2026

    @iket0731

    Hi Anthony Kim (@anthonykim1), I have a local fix for this issue. May I open a PR for it?

    The problem appears to be caused by the PowerShell tree-sitter grammar treating a standalone -- as a parse error. I added a workaround that masks the token before parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions