github.com/andrewrech/lazygit@v0.8.1/pkg/git/testdata/testPatchAfter3.diff (about) 1 diff --git a/pkg/git/patch_modifier.go b/pkg/git/patch_modifier.go 2 index a8fc600..6d8f7d7 100644 3 --- a/pkg/git/patch_modifier.go 4 +++ b/pkg/git/patch_modifier.go 5 @@ -36,18 +36,19 @@ func (p *PatchModifier) ModifyPatchForHunk(patch string, hunkStarts []int, curre 6 hunkEnd = hunkStarts[nextHunkStartIndex] 7 } 8 9 headerLength := 4 10 output := strings.Join(lines[0:headerLength], "\n") + "\n" 11 output += strings.Join(lines[hunkStart:hunkEnd], "\n") + "\n" 12 13 return output, nil 14 } 15 16 +func getHeaderLength(patchLines []string) (int, error) { 17 // ModifyPatchForLine takes the original patch, which may contain several hunks, 18 // and the line number of the line we want to stage 19 func (p *PatchModifier) ModifyPatchForLine(patch string, lineNumber int) (string, error) { 20 lines := strings.Split(patch, "\n") 21 headerLength := 4 22 output := strings.Join(lines[0:headerLength], "\n") + "\n" 23 24 hunkStart, err := p.getHunkStart(lines, lineNumber) 25