mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
read REBASE_HEAD when rebasing, swap yours/theirs (label, sides) as well (#155208)
https://github.com/microsoft/vscode/issues/153737
This commit is contained in:
@@ -418,6 +418,7 @@ export class CommandCenter {
|
||||
return;
|
||||
}
|
||||
|
||||
const isRebasing = Boolean(repo.rebaseCommit);
|
||||
|
||||
type InputData = { uri: Uri; title?: string; detail?: string; description?: string };
|
||||
const mergeUris = toMergeUris(uri);
|
||||
@@ -425,14 +426,17 @@ export class CommandCenter {
|
||||
const theirs: InputData = { uri: mergeUris.theirs, title: localize('Theirs', 'Theirs') };
|
||||
|
||||
try {
|
||||
const [head, mergeHead] = await Promise.all([repo.getCommit('HEAD'), repo.getCommit('MERGE_HEAD')]);
|
||||
const [head, rebaseOrMergeHead] = await Promise.all([
|
||||
repo.getCommit('HEAD'),
|
||||
isRebasing ? repo.getCommit('REBASE_HEAD') : repo.getCommit('MERGE_HEAD')
|
||||
]);
|
||||
// ours (current branch and commit)
|
||||
ours.detail = head.refNames.map(s => s.replace(/^HEAD ->/, '')).join(', ');
|
||||
ours.description = head.hash.substring(0, 7);
|
||||
|
||||
// theirs
|
||||
theirs.detail = mergeHead.refNames.join(', ');
|
||||
theirs.description = mergeHead.hash.substring(0, 7);
|
||||
theirs.detail = rebaseOrMergeHead.refNames.join(', ');
|
||||
theirs.description = rebaseOrMergeHead.hash.substring(0, 7);
|
||||
|
||||
} catch (error) {
|
||||
// not so bad, can continue with just uris
|
||||
@@ -442,8 +446,8 @@ export class CommandCenter {
|
||||
|
||||
const options = {
|
||||
base: mergeUris.base,
|
||||
input1: theirs,
|
||||
input2: ours,
|
||||
input1: isRebasing ? ours : theirs,
|
||||
input2: isRebasing ? theirs : ours,
|
||||
output: uri
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user