Skip to content

Terminal links for git diffs do not work with mnemonic prefixes #302823

Closed

Description

Type: Bug

In a git repository with some changes made, run git -c diff.mnemonicPrefix=true diff to see the diff with the mnemonicPrefix config enabled; this uses different prefixes instead of a/ and b/ to show more detail about the source of the files in the diff view.

When this option is enabled, the link detection in the terminal no longer creates correct links (i.e., stripping the prefix):

Image

The correct link here is just gitconfig, but the underline (from cmd-mouseover) shows a link was created for w/gitconfig instead.

VS Code version: Code 1.109.4 (Universal) (c3a2684, 2026-02-16T15:35:57.932Z)
OS version: Darwin arm64 25.3.0
Remote OS version: Linux arm64 6.8.0-1047-aws

Activity

  1. vs-code-engineering commented on Mar 18, 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.112.0. Please try upgrading to the latest version and checking whether this issue remains.

    Happy Coding!

  2. added
    bug
    on Jul 12, 2026
  3. added
    unreleased
    on Jul 13, 2026
  4. vs-code-engineering commented on Jul 13, 2026

    @vs-code-engineering
    Contributor

    Sharing media and context from merged PR #298490 for verification:

    Git supports a config option diff.mnemonicPrefix that sometimes uses characters other than a/ and b/ in diffs to distinguish where they came from. This PR updates the link parsing in the integrated terminal, so file paths are still detected when this option is enabled.

    I updated the existing tests for this functionality.

    Manual testing

    Make some change in a git repo (e.g. echo "hello world" >>README.md).

    Enable this config option and run git diff: git -c diff.mnemonicPrefix=true diff in the terminal will now be comparing the index and the working copy files:

    diff --git i/README.md w/README.md
    index 6f1e94e4844..0dc323dc715 100644
    --- i/README.md
    +++ w/README.md
    @@ -76,3 +76,4 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
     Copyright (c) Microsoft Corporation. All rights reserved.
    
     Licensed under the [MIT](LICENSE.txt) license.
    +hello world

    With this change, README.md in each location should be underlined on hover and possible to open with ⌘/ctrl+click.
    Notably, cmd-click will open README.md, and not attempt to find a file named w/README.md

    CleanShot 2026-02-28 at 15 31 50@2x

    Source PR: #298490

  5. added
    insiders-released
    and removed
    unreleased
    on Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

buginsiders-releasedterminal-linksverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions