diff --git a/pkg/commands/patch/patch_manager.go b/pkg/commands/patch/patch_manager.go index e3f6cd454..e50c0fd3a 100644 --- a/pkg/commands/patch/patch_manager.go +++ b/pkg/commands/patch/patch_manager.go @@ -245,6 +245,8 @@ func (p *PatchManager) GetFileIncLineIndices(filename string) ([]int, error) { } func (p *PatchManager) ApplyPatches(reverse bool) error { + patch := "" + applyFlags := []string{"index", "3way"} if reverse { applyFlags = append(applyFlags, "reverse") @@ -255,16 +257,10 @@ func (p *PatchManager) ApplyPatches(reverse bool) error { continue } - patch := p.RenderPatchForFile(filename, true, reverse) - if patch != "" { - err := p.applyPatch(patch, applyFlags...) - if err != nil { - return err - } - } + patch += p.RenderPatchForFile(filename, true, reverse) } - return nil + return p.applyPatch(patch, applyFlags...) } // clears the patch diff --git a/pkg/integration/tests/patch_building/apply_in_reverse_with_conflict.go b/pkg/integration/tests/patch_building/apply_in_reverse_with_conflict.go index 8c3e61a86..04d160a01 100644 --- a/pkg/integration/tests/patch_building/apply_in_reverse_with_conflict.go +++ b/pkg/integration/tests/patch_building/apply_in_reverse_with_conflict.go @@ -52,7 +52,7 @@ var ApplyInReverseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ t.ExpectPopup().Alert(). Title(Equals("Error")). Content(Contains("Applied patch to 'file1' with conflicts."). - DoesNotContain("Applied patch to 'file2' cleanly.")). + Contains("Applied patch to 'file2' cleanly.")). Confirm() t.Views().Files(). @@ -79,6 +79,7 @@ var ApplyInReverseWithConflict = NewIntegrationTest(NewIntegrationTestArgs{ Focus(). Lines( Contains("M").Contains("file1").IsSelected(), + Contains("M").Contains("file2"), ) t.Views().Main().