Microsoft/vscode

Git diff does not show files with long paths in Source Control View (Windows)

Open

#240,770 opened on Feb 14, 2025

View on GitHub
 (0 comments) (0 reactions) (1 assignee)TypeScript (10,221 forks)batch import
buggithelp wanted

Repository metrics

Stars
 (74,848 stars)
PR merge metrics
 (Avg merge 11h 43m) (1,000 merged PRs in 30d)

Description

  • VS Code 版本: 1.97.1

  • 操作系统: Windows 10

  • Git 版本: 2.47.1.windows.1

  • 问题描述: 在 VS Code 的 "源代码管理" 视图(Source Control View)中,点击某一个commit后,对比窗口不能正确显示路径过长的文件。
    但在终端运行 git diff 可以看到这些文件的变更。

复现步骤

  1. 创建一个路径超过 219 个字符的文件,并提交到 Git 仓库。
  2. 修改该文件。
  3. 在 VS Code 的 "源代码管理" 视图中查看变更。
  4. 发现该文件未出现在 Git 变更列表中,但终端运行 git diff 能正确显示。

Image

预期行为

  • VS Code 应该与 git diff 一致,能够正确显示所有被修改的文件。

实际行为

  • 部分路径过长的文件不会显示在 Git 对比(diff)窗口中。

可能的影响范围

  • Windows 用户(默认 MAX_PATH 限制 260 字符)

Contributor guide