Skip to content

Commit

Permalink
refactor (#470)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Sep 20, 2022
1 parent cb53324 commit e3e3211
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions gitoxide-core/src/hours.rs
Expand Up @@ -204,29 +204,29 @@ where
if entry_mode.is_no_tree() {
files.modified += 1;
}
if line_stats {
if let Some(Ok(diff)) = change.event.diff() {
use git::diff::lines::similar::ChangeTag::*;
let mut nl = 0;
for change in diff
.text(git::diff::lines::Algorithm::Myers)
.iter_all_changes()
{
match change.tag() {
Delete => {
lines.removed += 1;
nl += 1;
}
Insert => {
lines.added += 1;
nl += 1
}
Equal => {}
if let Some(Ok(diff)) =
line_stats.then(|| change.event.diff()).flatten()
{
use git::diff::lines::similar::ChangeTag::*;
let mut nl = 0;
for change in diff
.text(git::diff::lines::Algorithm::Myers)
.iter_all_changes()
{
match change.tag() {
Delete => {
lines.removed += 1;
nl += 1;
}
Insert => {
lines.added += 1;
nl += 1
}
Equal => {}
}
if let Some(c) = lines_counter.as_ref() {
c.fetch_add(nl, Ordering::SeqCst);
}
}
if let Some(c) = lines_counter.as_ref() {
c.fetch_add(nl, Ordering::SeqCst);
}
}
}
Expand Down

0 comments on commit e3e3211

Please sign in to comment.