SCM - Include stashes in the SCM history graph#302315
SCM - Include stashes in the SCM history graph#302315iumehara wants to merge 1 commit intomicrosoft:mainfrom
Conversation
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
There was a problem hiding this comment.
Pull request overview
Adds stash awareness to the Git SCM history provider so stashes can appear as history refs, stash “index” commits are hidden from history results, and stash refs are attached to matching stash commits.
Changes:
- Extend
GitHistoryProviderto fetch/sync stash refs, include them inprovideHistoryItemRefs, and attach stash refs to matching commits. - Filter out “index on …” stash index commits from
provideHistoryItemsresults. - Add unit tests covering stash ref inclusion/sorting/error handling and stash-related history filtering/attachment behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| extensions/git/src/historyProvider.ts | Adds stash ref syncing, stash commit filtering, and stash ref attachment to history items. |
| extensions/git/src/test/historyProvider.test.ts | Introduces unit tests for stash refs and stash-related history item behavior. |
You can also share your feedback on Copilot code review. Take the survey.
| const updateComplete = new Promise<void>(resolve => { | ||
| gitHistoryProvider.onDidChangeCurrentHistoryItemRefs(() => resolve(), { dispose: () => { } }); | ||
| }); | ||
| onDidRunOperationEmitter.fire({ operation: { kind: 0 } }); | ||
| await updateComplete; |
There was a problem hiding this comment.
Opted for { operation: { kind: OperationKind.Commit, readOnly: false, showProgress: false } } instead because,
OperationKind.CommitandOperationKind.Stashare the correct kinds of operation in this casereadOnly: trueoperations get filtered out in the constructor
|
|
||
| const historyItems = await gitHistoryProvider.provideHistoryItems({ historyItemRefs: ['refs/heads/main'] }, {} as CancellationToken); | ||
|
|
There was a problem hiding this comment.
Unchanged, as CancellationToken is an interface, and the CancellationToken.None defined in the internal codebase is not exposed to the extension API.
| ]; | ||
| mockRepository.log.resolves(commits); | ||
|
|
||
| const historyItems = await gitHistoryProvider.provideHistoryItems({ historyItemRefs: ['refs/heads/main'] }, {} as CancellationToken); |
There was a problem hiding this comment.
Unchanged. CancellationToken is an interface, as explained in comment above
b01a222 to
d28eda0
Compare
- historyProvider.provideHistoryItemRefs includes stashes - historyProvider.provideHistoryItems includes stashes but not stash index commits - onDidRunWriteOperation diff calculation includes change in stash history - Avoid potential racecondition in stashRef with @sequentialize decorator
d28eda0 to
b11855b
Compare
For Issue #280264
Behavior: