1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

Make parseDiff a non-member function so that we can test it more easily

This commit is contained in:
Stefan Haller
2024-05-19 17:10:34 +02:00
parent a957c5542f
commit e1b4d625c7

View File

@ -41,7 +41,7 @@ func (self *FixupHelper) HandleFindBaseCommitForFixupPress() error {
return errors.New(self.c.Tr.NoChangedFiles)
}
deletedLineHunks, hasHunksWithOnlyAddedLines := self.parseDiff(diff)
deletedLineHunks, hasHunksWithOnlyAddedLines := parseDiff(diff)
if len(deletedLineHunks) == 0 {
return errors.New(self.c.Tr.NoDeletedLinesInDiff)
}
@ -122,7 +122,7 @@ func (self *FixupHelper) getDiff() (string, bool, error) {
return diff, hasStagedChanges, err
}
func (self *FixupHelper) parseDiff(diff string) ([]*hunk, bool) {
func parseDiff(diff string) ([]*hunk, bool) {
lines := strings.Split(strings.TrimSuffix(diff, "\n"), "\n")
deletedLineHunks := []*hunk{}