1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-12-20 21:22:01 +03:00

refactor: use strings.Builder and strings.Repeat to simplify code

Signed-off-by: boqishan <boqishan@126.com>
This commit is contained in:
boqishan
2025-11-25 17:46:25 +08:00
committed by Stefan Haller
parent 8396747cf1
commit 89a0542a97
3 changed files with 17 additions and 14 deletions

View File

@@ -66,22 +66,22 @@ func (p *PatchBuilder) Start(from, to string, reverse bool, canRebase bool) {
}
func (p *PatchBuilder) PatchToApply(reverse bool, turnAddedFilesIntoDiffAgainstEmptyFile bool) string {
patch := ""
var patch strings.Builder
for filename, info := range p.fileInfoMap {
if info.mode == UNSELECTED {
continue
}
patch += p.RenderPatchForFile(RenderPatchForFileOpts{
patch.WriteString(p.RenderPatchForFile(RenderPatchForFileOpts{
Filename: filename,
Plain: true,
Reverse: reverse,
TurnAddedFilesIntoDiffAgainstEmptyFile: turnAddedFilesIntoDiffAgainstEmptyFile,
})
}))
}
return patch
return patch.String()
}
func (p *PatchBuilder) addFileWhole(info *fileInfo) {