Skip to content

Commit

Permalink
Fix format_diff_lines.pl triggering on deleted files
Browse files Browse the repository at this point in the history
  • Loading branch information
Technius committed Feb 3, 2020
1 parent 8a94313 commit 2ba95b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
5 changes: 5 additions & 0 deletions azure-pipelines/util/format_diff_lines.pl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ sub push_changes {
}
}

# Extract ranges of added lines
while (my $line = <STDIN>) {
if ($line =~ /^diff .* a\/(?<old_file>.*) b\/(?<new_file>.*)$/) {
# New file
Expand All @@ -43,6 +44,10 @@ sub push_changes {
} elsif ($line =~ /^@@ -([0-9]+)(,([0-9]+))? \+(?<new_pos>[0-9]+)(,(?<new_len>[0-9]+))? @@/) {
my $new_len = $+{new_len};
$new_len = 1 if ($new_len eq "");
if ($new_len == 0) {
# Ignore hunks with no added lines
next;
}
push @hunks, [$+{new_pos}, $new_len];
}
}
Expand Down
28 changes: 0 additions & 28 deletions azure-pipelines/util/sample.cpp

This file was deleted.

0 comments on commit 2ba95b3

Please sign in to comment.