Skip to content

Git - show staged type changes in the Source Control view#326350

Open
soreavis wants to merge 1 commit into
microsoft:mainfrom
soreavis:fix/91100-staged-type-change
Open

Git - show staged type changes in the Source Control view#326350
soreavis wants to merge 1 commit into
microsoft:mainfrom
soreavis:fix/91100-staged-type-change

Conversation

@soreavis

Copy link
Copy Markdown

Staging a type change — for example replacing a symlink with a regular file and then git add-ing it — left the file invisible in the Source Control view. git status reports a staged type change as T (T in the index column), but the index-side parser in updateModelState only handled M/A/D/R/C, so the resource was silently dropped. The unstaged case has shown correctly since #187714 (2023), which added Status.TYPE_CHANGED for the working-tree side only.

This adds a matching Status.INDEX_TYPE_CHANGED and routes a staged T into the index group, mirroring how INDEX_MODIFIED relates to MODIFIED: staged color (gitDecoration.stageModifiedResourceForeground), the (Index) diff title, HEAD↔index diff, and the existing type-changed glyph. The new value is appended to the end of the Status enum so no existing ordinal shifts.

Fixes #91100

How I verified

Added a smoke test covering the issue body's exact steps (symlink → commit → replace with a regular file → stage), asserting the unstaged change surfaces as TYPE_CHANGED and the staged one as INDEX_TYPE_CHANGED. The full git integration suite passes locally (58 passing, including the new test). Skipped on Windows, where creating a symlink needs elevation.

Staging a type change (e.g. replacing a symlink with a regular file,
then git add) left the file invisible in the Source Control view: the
index-side status parser handled M/A/D/R/C but not T, so the resource
was dropped.

Add an INDEX_TYPE_CHANGED status, mirroring how INDEX_MODIFIED relates
to MODIFIED, and route a staged 'T' into the index group. Working-tree
type changes were already handled (Status.TYPE_CHANGED, microsoft#187714); this
covers the staged side. The new value is appended to the Status enum so
no existing ordinal changes.

Fixes microsoft#91100
Copilot AI review requested due to automatic review settings July 17, 2026 14:25
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@lszomoru

Matched files:

  • extensions/git/src/api/api1.ts
  • extensions/git/src/api/git.constants.ts
  • extensions/git/src/api/git.d.ts
  • extensions/git/src/repository.ts
  • extensions/git/src/test/smoke.test.ts
  • extensions/github/src/typings/git.constants.ts
  • extensions/github/src/typings/git.d.ts

@soreavis

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for staged Git type changes in Source Control.

Changes:

  • Adds INDEX_TYPE_CHANGED to Git API typings/constants.
  • Maps staged T statuses to index resources and appropriate UI/diff behavior.
  • Adds a symlink-to-file smoke test.

Reviewed changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
extensions/github/src/typings/git.d.ts Updates GitHub Git typings.
extensions/github/src/typings/git.constants.ts Adds the runtime status constant.
extensions/git/src/test/smoke.test.ts Tests staged and unstaged type changes.
extensions/git/src/repository.ts Parses and displays staged type changes.
extensions/git/src/api/git.d.ts Extends the public status enum.
extensions/git/src/api/git.constants.ts Adds the public runtime constant.
extensions/git/src/api/api1.ts Serializes the new status name.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git - Git Typechanges do not appear in source control panel

3 participants