mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
Fix git merge editor for renames (#209542)
This commit is contained in:
@@ -711,10 +711,13 @@ export class CommandCenter {
|
||||
}
|
||||
|
||||
try {
|
||||
const [head, rebaseOrMergeHead] = await Promise.all([
|
||||
const [head, rebaseOrMergeHead, diffBetween] = await Promise.all([
|
||||
repo.getCommit('HEAD'),
|
||||
isRebasing ? repo.getCommit('REBASE_HEAD') : repo.getCommit('MERGE_HEAD')
|
||||
isRebasing ? repo.getCommit('REBASE_HEAD') : repo.getCommit('MERGE_HEAD'),
|
||||
await repo.diffBetween(isRebasing ? 'REBASE_HEAD' : 'MERGE_HEAD', 'HEAD')
|
||||
]);
|
||||
const diffFile = diffBetween?.find(diff => diff.uri.fsPath === uri.fsPath);
|
||||
|
||||
// ours (current branch and commit)
|
||||
current.detail = head.refNames.map(s => s.replace(/^HEAD ->/, '')).join(', ');
|
||||
current.description = '$(git-commit) ' + head.hash.substring(0, 7);
|
||||
@@ -723,7 +726,11 @@ export class CommandCenter {
|
||||
// theirs
|
||||
incoming.detail = rebaseOrMergeHead.refNames.join(', ');
|
||||
incoming.description = '$(git-commit) ' + rebaseOrMergeHead.hash.substring(0, 7);
|
||||
incoming.uri = toGitUri(uri, rebaseOrMergeHead.hash);
|
||||
if (diffFile) {
|
||||
incoming.uri = toGitUri(diffFile.originalUri, rebaseOrMergeHead.hash);
|
||||
} else {
|
||||
incoming.uri = toGitUri(uri, rebaseOrMergeHead.hash);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
// not so bad, can continue with just uris
|
||||
|
||||
Reference in New Issue
Block a user