mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 04:23:32 +01:00
Git - use commit id for the left-hand editor (#194302)
* Git - use commit id for the left-hand editor * Remove console.log
This commit is contained in:
@@ -102,13 +102,19 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
|
||||
}
|
||||
|
||||
async provideHistoryItemChanges(historyItemId: string): Promise<SourceControlHistoryItemChange[]> {
|
||||
const [ref1, ref2] = historyItemId.includes('..')
|
||||
? historyItemId.split('..')
|
||||
: [`${historyItemId}^`, historyItemId];
|
||||
// The "All Changes" history item uses a special id
|
||||
// which is a commit range instead of a single commit id
|
||||
let [originalRef, modifiedRef] = historyItemId.includes('..')
|
||||
? historyItemId.split('..') : [undefined, historyItemId];
|
||||
|
||||
if (!originalRef) {
|
||||
const commit = await this.repository.getCommit(modifiedRef);
|
||||
originalRef = commit.parents.length > 0 ? commit.parents[0] : `${modifiedRef}^`;
|
||||
}
|
||||
|
||||
const historyItemChangesUri: Uri[] = [];
|
||||
const historyItemChanges: SourceControlHistoryItemChange[] = [];
|
||||
const changes = await this.repository.diffBetween(ref1, ref2);
|
||||
const changes = await this.repository.diffBetween(originalRef, modifiedRef);
|
||||
|
||||
for (const change of changes) {
|
||||
const historyItemUri = change.uri.with({
|
||||
@@ -118,8 +124,8 @@ export class GitHistoryProvider implements SourceControlHistoryProvider, FileDec
|
||||
// History item change
|
||||
historyItemChanges.push({
|
||||
uri: historyItemUri,
|
||||
originalUri: toGitUri(change.originalUri, ref1),
|
||||
modifiedUri: toGitUri(change.originalUri, ref2),
|
||||
originalUri: toGitUri(change.originalUri, originalRef),
|
||||
modifiedUri: toGitUri(change.originalUri, modifiedRef),
|
||||
renameUri: change.renameUri,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user