summaryrefslogtreecommitdiffstats
path: root/src/parse.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse.rs')
-rw-r--r--src/parse.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/parse.rs b/src/parse.rs
index c2f4b0ad..006e7464 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -90,8 +90,23 @@ pub fn get_file_change_description_from_file_paths(
}
lazy_static! {
- static ref HUNK_METADATA_REGEXP: Regex =
- Regex::new(r"@+ (?P<lns>([-+]\d+(?:,\d+)? ){2,4})@+(?P<cf>.*\s?)").unwrap();
+ static ref HUNK_METADATA_REGEXP: Regex = Regex::new(
+ r"(?x)
+@+ # Start hunk header
+\ # One space
+(?P<lns> # Start file coordinates
+ ( # Start file coordinate
+ [-+] # - or +
+ \d+ # A digit
+ (?:,\d+)? # Optionally followed by a comma and another digit
+ \ # One space
+ ){2,4} #
+) #
+@+ # End hunk header
+(?P<cf>.*\s?) # Code fragment
+"
+ )
+ .unwrap();
}
lazy_static! {