Skip to content

Commit

Permalink
Prevent fail if patch has date behind filename.
Browse files Browse the repository at this point in the history
  • Loading branch information
michalsrb committed Jan 7, 2019
1 parent f55d418 commit adc3954
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/patch_unified.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const NO_NEW_LINE_TAG: &[u8] = b"\\ No newline at end of file\n";
const NULL_FILENAME: &[u8] = b"/dev/null";

lazy_static! {
static ref MINUS_FILENAME: Regex = Regex::new(r"^--- ([^\t]+)\n$").unwrap();
static ref PLUS_FILENAME: Regex = Regex::new(r"^\+\+\+ ([^\t]+)\n$").unwrap();
static ref MINUS_FILENAME: Regex = Regex::new(r"^--- ([^\t]+)(\t[^\n]*)?\n$").unwrap();
static ref PLUS_FILENAME: Regex = Regex::new(r"^\+\+\+ ([^\t]+)(\t[^\n]*)?\n$").unwrap();

// Warning: It seems that patch accepts if the second '@' in the second "@@" group is missing!
static ref CHUNK: Regex = Regex::new(r"^@@ -(?P<remove_line>[\d]+)(?:,(?P<remove_count>[\d]+))? \+(?P<add_line>[\d]+)(?:,(?P<add_count>[\d]+))? @@?(?P<place_name>.*)\n$").unwrap();
Expand Down

0 comments on commit adc3954

Please sign in to comment.