mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-08-07 22:02:56 +03:00
Make parseDiff a non-member function so that we can test it more easily
This commit is contained in:
@@ -41,7 +41,7 @@ func (self *FixupHelper) HandleFindBaseCommitForFixupPress() error {
|
|||||||
return errors.New(self.c.Tr.NoChangedFiles)
|
return errors.New(self.c.Tr.NoChangedFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
deletedLineHunks, hasHunksWithOnlyAddedLines := self.parseDiff(diff)
|
deletedLineHunks, hasHunksWithOnlyAddedLines := parseDiff(diff)
|
||||||
if len(deletedLineHunks) == 0 {
|
if len(deletedLineHunks) == 0 {
|
||||||
return errors.New(self.c.Tr.NoDeletedLinesInDiff)
|
return errors.New(self.c.Tr.NoDeletedLinesInDiff)
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ func (self *FixupHelper) getDiff() (string, bool, error) {
|
|||||||
return diff, hasStagedChanges, err
|
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")
|
lines := strings.Split(strings.TrimSuffix(diff, "\n"), "\n")
|
||||||
|
|
||||||
deletedLineHunks := []*hunk{}
|
deletedLineHunks := []*hunk{}
|
||||||
|
Reference in New Issue
Block a user