diff options
author | Johannes Rieken <johannes.rieken@gmail.com> | 2022-07-14 19:23:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-14 19:23:44 +0300 |
commit | 18785833193553da8235a0768716d317bb67175d (patch) | |
tree | 843f5f5d3a90687760e7c33fd9ffe91930047ad1 /extensions | |
parent | 0abc5761ca6f03e9c6455f20c6ff696b59683261 (diff) |
read `REBASE_HEAD` when rebasing, swap yours/theirs (label, sides) as well (#155208)
https://github.com/microsoft/vscode/issues/153737
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/git/src/commands.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 37c500f7605..0e3e19792cc 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -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 }; |