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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user