From 4d35f1d2ff1c8f6da6552b22ca94a3ce2d46783b Mon Sep 17 00:00:00 2001 From: Avikalp Kumar Gupta Date: Thu, 26 Oct 2023 16:51:25 +0530 Subject: [PATCH] minor: utils/gitops: renamed wordvec to blame_line_words to make it easier to read --- vibi-dpu/src/utils/gitops.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vibi-dpu/src/utils/gitops.rs b/vibi-dpu/src/utils/gitops.rs index faa5081a..6bde3d64 100644 --- a/vibi-dpu/src/utils/gitops.rs +++ b/vibi-dpu/src/utils/gitops.rs @@ -430,11 +430,11 @@ async fn process_blameitem(path: &str, linenum: &str, blamelines: Vec<&str>) -> async fn process_blamelines(blamelines: &Vec<&str>, linenum: usize) -> HashMap { let mut linemap = HashMap::::new(); for lnum in 0..blamelines.len() { - let ln = blamelines[lnum]; - let wordvec: Vec<&str> = ln.split(" ").collect(); - let commit = wordvec[0].to_string(); - let (author, idx) = extract_author(&wordvec); - let timestamp = extract_timestamp(&wordvec, idx); + let blame_line = blamelines[lnum]; + let blame_line_words: Vec<&str> = blame_line.split(" ").collect(); + let commit = blame_line_words[0].to_string(); + let (author, idx) = extract_author(&blame_line_words); + let timestamp = extract_timestamp(&blame_line_words, idx); let lineitem = LineItem::new(author, timestamp, commit); linemap.insert( linenum + lnum, @@ -444,17 +444,17 @@ async fn process_blamelines(blamelines: &Vec<&str>, linenum: usize) -> HashMap) -> (String, usize) { - let mut author = wordvec[1]; +fn extract_author(blame_line_words: &Vec<&str>) -> (String, usize) { + let mut author = blame_line_words[1]; let mut idx = 1; // Check if the second value is an email address (enclosed in angle brackets) if !author.starts_with('(') && !author.ends_with('>') { // Shift the index to the next non-empty value - while idx < wordvec.len() && (wordvec[idx] == "" || !wordvec[idx].starts_with('(')){ + while idx < blame_line_words.len() && (blame_line_words[idx] == "" || !blame_line_words[idx].starts_with('(')){ idx += 1; } - if idx < wordvec.len() { - author = wordvec[idx]; + if idx < blame_line_words.len() { + author = blame_line_words[idx]; } } else { // Remove the angle brackets from the email address