mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-10 15:46:26 -04:00
Make parseDiff a non-member function so that we can test it more easily
This commit is contained in:
parent
a957c5542f
commit
e1b4d625c7
|
|
@ -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{}
|
||||
|
|
|
|||
Loading…
Reference in a new issue