Git - show staged type changes in the Source Control view#326350
Open
soreavis wants to merge 1 commit into
Open
Git - show staged type changes in the Source Control view#326350soreavis wants to merge 1 commit into
soreavis wants to merge 1 commit into
Conversation
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
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for staged Git type changes in Source Control.
Changes:
- Adds
INDEX_TYPE_CHANGEDto Git API typings/constants. - Maps staged
Tstatuses 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 statusreports a staged type change asT(T in the index column), but the index-side parser inupdateModelStateonly handledM/A/D/R/C, so the resource was silently dropped. The unstaged case has shown correctly since #187714 (2023), which addedStatus.TYPE_CHANGEDfor the working-tree side only.This adds a matching
Status.INDEX_TYPE_CHANGEDand routes a stagedTinto the index group, mirroring howINDEX_MODIFIEDrelates toMODIFIED: 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 theStatusenum 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_CHANGEDand the staged one asINDEX_TYPE_CHANGED. The full git integration suite passes locally (58 passing, including the new test). Skipped on Windows, where creating a symlink needs elevation.