diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-02-23 18:50:53 +0100 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-03-07 09:49:34 +0100 |
commit | 6bd1c1d06807fced80ca0bdbc736c2da39ae3dcf (patch) | |
tree | f3445153e3834ce9512a9ab6ef23f7374d130c47 | |
parent | 5d692e89610166fc0c4458de8b4f5acabc6e4b6f (diff) |
Remove parameters that are no longer needed
All callers in this file now use reverseOnGenerate=false and
keepOriginalHeader=true, so hard-code that in the call to ModifiedPatchForLines
and get rid of the parameters.
-rw-r--r-- | pkg/commands/patch/patch_manager.go | 14 | ||||
-rw-r--r-- | pkg/gui/refresh.go | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/pkg/commands/patch/patch_manager.go b/pkg/commands/patch/patch_manager.go index 7e1721b7f..e3f6cd454 100644 --- a/pkg/commands/patch/patch_manager.go +++ b/pkg/commands/patch/patch_manager.go @@ -162,7 +162,7 @@ func (p *PatchManager) RemoveFileLineRange(filename string, firstLineIdx, lastLi return nil } -func (p *PatchManager) renderPlainPatchForFile(filename string, reverse bool, willBeAppliedReverse bool, keepOriginalHeader bool) string { +func (p *PatchManager) renderPlainPatchForFile(filename string, willBeAppliedReverse bool) string { info, err := p.getFileInfo(filename) if err != nil { p.Log.Error(err) @@ -178,17 +178,17 @@ func (p *PatchManager) renderPlainPatchForFile(filename string, reverse bool, wi // generate a new diff with just the selected lines return ModifiedPatchForLines(p.Log, filename, info.diff, info.includedLineIndices, PatchOptions{ - Reverse: reverse, + Reverse: false, WillBeAppliedReverse: willBeAppliedReverse, - KeepOriginalHeader: keepOriginalHeader, + KeepOriginalHeader: true, }) default: return "" } } -func (p *PatchManager) RenderPatchForFile(filename string, plain bool, reverse bool, willBeAppliedReverse bool, keepOriginalHeader bool) string { - patch := p.renderPlainPatchForFile(filename, reverse, willBeAppliedReverse, keepOriginalHeader) +func (p *PatchManager) RenderPatchForFile(filename string, plain bool, willBeAppliedReverse bool) string { + patch := p.renderPlainPatchForFile(filename, willBeAppliedReverse) if plain { return patch } @@ -204,7 +204,7 @@ func (p *PatchManager) renderEachFilePatch(plain bool) []string { sort.Strings(filenames) patches := slices.Map(filenames, func(filename string) string { - return p.RenderPatchForFile(filename, plain, false, false, true) + return p.RenderPatchForFile(filename, plain, false) }) output := slices.Filter(patches, func(patch string) bool { return patch != "" @@ -255,7 +255,7 @@ func (p *PatchManager) ApplyPatches(reverse bool) error { continue } - patch := p.RenderPatchForFile(filename, true, false, reverse, true) + patch := p.RenderPatchForFile(filename, true, reverse) if patch != "" { err := p.applyPatch(patch, applyFlags...) if err != nil { diff --git a/pkg/gui/refresh.go b/pkg/gui/refresh.go index 60ca0accb..0c6315767 100644 --- a/pkg/gui/refresh.go +++ b/pkg/gui/refresh.go @@ -672,7 +672,7 @@ func (gui *Gui) refreshPatchBuildingPanel(opts types.OnFocusOpts) error { return err } - secondaryDiff := gui.git.Patch.PatchManager.RenderPatchForFile(path, false, false, false, true) + secondaryDiff := gui.git.Patch.PatchManager.RenderPatchForFile(path, false, false) if err != nil { return err } |