diff options
author | Thomas Otto <th1000s@posteo.net> | 2022-01-14 00:16:15 +0100 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2022-01-13 19:53:28 -0500 |
commit | e9bec95a571152ec50e9e6b6a2e2051a4a01625d (patch) | |
tree | cb2248bc107a76b5c7b30825e1146a6621deab09 /src | |
parent | c323fa529ba3188ceff041509ed2b0a44226f7bc (diff) |
Handle blame author names containing parentheses
Diffstat (limited to 'src')
-rw-r--r-- | src/handlers/blame.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/handlers/blame.rs b/src/handlers/blame.rs index b3d628a6..01094853 100644 --- a/src/handlers/blame.rs +++ b/src/handlers/blame.rs @@ -185,9 +185,9 @@ lazy_static! { ( \^?[0-9a-f]{4,40} # commit hash (^ is 'boundary commit' marker) ) -(?: .+)? # optional file name (unused; present if file has been renamed; TODO: inefficient?) +(?: [^(]+)? # optional file name (unused; present if file has been renamed; TODO: inefficient?) [\ ] -\( # open ( +\( # open ( which the previous file name may not contain in case a name does (which is more likely) ( [^\ ].*[^\ ] # author name ) @@ -298,6 +298,14 @@ mod tests { } #[test] + fn test_blame_line_with_parens_in_name() { + let line = + "61f180c8 (Kangwook Lee (이강욱) 2021-06-09 23:33:59 +0900 130) let mut output_type ="; + let caps = BLAME_LINE_REGEX.captures(line).unwrap(); + assert_eq!(caps.get(2).unwrap().as_str(), "Kangwook Lee (이강욱)"); + } + + #[test] fn test_color_assignment() { let mut writer = Cursor::new(vec![0; 512]); let config = integration_test_utils::make_config_from_args(&["--blame-palette", "1 2"]); |