(hunk *git.Hunk, regexStr string)
| 676 | } |
| 677 | |
| 678 | func (a *App) hunkMatchesRegex(hunk *git.Hunk, regexStr string) bool { |
| 679 | regex, err := regexp.Compile(regexStr) |
| 680 | if err != nil { |
| 681 | return false |
| 682 | } |
| 683 | |
| 684 | for _, line := range hunk.Text { |
| 685 | if regex.MatchString(line) { |
| 686 | return true |
| 687 | } |
| 688 | } |
| 689 | return false |
| 690 | } |
| 691 | |
| 692 | func (a *App) filterHunksByRegex(hunks []git.Hunk, regexStr string) []git.Hunk { |
| 693 | // Validate regex first |
no outgoing calls