MCPcopy
hub / github.com/jesseduffield/lazygit / PatchToApply

Method PatchToApply

pkg/commands/patch/patch_builder.go:68–85  ·  view source on GitHub ↗
(reverse bool, turnAddedFilesIntoDiffAgainstEmptyFile bool)

Source from the content-addressed store, hash-verified

66}
67
68func (p *PatchBuilder) PatchToApply(reverse bool, turnAddedFilesIntoDiffAgainstEmptyFile bool) string {
69 var patch strings.Builder
70
71 for filename, info := range p.fileInfoMap {
72 if info.mode == UNSELECTED {
73 continue
74 }
75
76 patch.WriteString(p.RenderPatchForFile(RenderPatchForFileOpts{
77 Filename: filename,
78 Plain: true,
79 Reverse: reverse,
80 TurnAddedFilesIntoDiffAgainstEmptyFile: turnAddedFilesIntoDiffAgainstEmptyFile,
81 }))
82 }
83
84 return patch.String()
85}
86
87func (p *PatchBuilder) addFileWhole(info *fileInfo) {
88 if info.mode != WHOLE {

Callers 1

ApplyCustomPatchMethod · 0.80

Calls 3

RenderPatchForFileMethod · 0.95
WriteStringMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected