mirror of
https://github.com/Microsoft/vscode
synced 2024-10-02 17:32:41 +00:00
Fix git merge editor for renames (#209542)
This commit is contained in:
parent
09734e0145
commit
a1815b994a
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue