diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-05-19 17:10:34 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2024-06-01 08:31:18 +0200 |
commit | e1b4d625c7d7d11bea1a42c6fe5fea3ff2a9e415 (patch) | |
tree | 4f1795ce88daee7fa508472088dd18bb5d06d5a1 /pkg | |
parent | a957c5542fc513a8e9aa72089c1c691696b9addb (diff) |
Make parseDiff a non-member function so that we can test it more easily
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/gui/controllers/helpers/fixup_helper.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/gui/controllers/helpers/fixup_helper.go b/pkg/gui/controllers/helpers/fixup_helper.go index e50389e90..e8fe1d2f2 100644 --- a/pkg/gui/controllers/helpers/fixup_helper.go +++ b/pkg/gui/controllers/helpers/fixup_helper.go @@ -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{} |