From 325a919569af204f5b1d6ebe35e534a5aa14c2cd Mon Sep 17 00:00:00 2001 From: Zhuowei Zhang Date: Mon, 21 May 2018 21:47:45 -0400 Subject: [PATCH] git: Detect conflict markets in BOTH_ADDED files when staging The existing code only checked for conflict markers for files with BOTH_MODIFIED status; files with BOTH_ADDED status were always detected as conflicting even after conflicts are resolved. This fixes #44106. --- extensions/git/src/commands.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extensions/git/src/commands.ts b/extensions/git/src/commands.ts index 1ca402bf14f77..befe0dd07d1b2 100644 --- a/extensions/git/src/commands.ts +++ b/extensions/git/src/commands.ts @@ -624,12 +624,13 @@ export class CommandCenter { const selection = resourceStates.filter(s => s instanceof Resource) as Resource[]; const merge = selection.filter(s => s.resourceGroupType === ResourceGroupType.Merge); - const bothModified = merge.filter(s => s.type === Status.BOTH_MODIFIED); + const isBothAddedOrModified = (s: Resource) => s.type === Status.BOTH_MODIFIED || s.type === Status.BOTH_ADDED; + const bothModified = merge.filter(isBothAddedOrModified); const promises = bothModified.map(s => grep(s.resourceUri.fsPath, /^<{7}|^={7}|^>{7}/)); const unresolvedBothModified = await Promise.all(promises); const resolvedConflicts = bothModified.filter((s, i) => !unresolvedBothModified[i]); const unresolvedConflicts = [ - ...merge.filter(s => s.type !== Status.BOTH_MODIFIED), + ...merge.filter(s => !isBothAddedOrModified(s)), ...bothModified.filter((s, i) => unresolvedBothModified[i]) ];