aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/email/patch.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/email/patch.go')
-rw-r--r--pkg/email/patch.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/pkg/email/patch.go b/pkg/email/patch.go
index c77d19bed..67ea9005a 100644
--- a/pkg/email/patch.go
+++ b/pkg/email/patch.go
@@ -39,14 +39,15 @@ func ParsePatch(message []byte) (diff string) {
return
}
+var diffRegexps = []*regexp.Regexp{
+ regexp.MustCompile(`^(---|\+\+\+) [^\s]`),
+ regexp.MustCompile(`^diff --git`),
+ regexp.MustCompile(`^index [0-9a-f]+\.\.[0-9a-f]+`),
+ regexp.MustCompile(`^new file mode [0-9]+`),
+ regexp.MustCompile(`^Index: [^\s]`),
+}
+
func lineMatchesDiffStart(ln string) bool {
- diffRegexps := []*regexp.Regexp{
- regexp.MustCompile(`^(---|\+\+\+) [^\s]`),
- regexp.MustCompile(`^diff --git`),
- regexp.MustCompile(`^index [0-9a-f]+\.\.[0-9a-f]+`),
- regexp.MustCompile(`^new file mode [0-9]+`),
- regexp.MustCompile(`^Index: [^\s]`),
- }
for _, re := range diffRegexps {
if re.MatchString(ln) {
return true