Fix format_diff_lines.pl triggering on deleted files

presentation
Bryan Tan 6 years ago
parent c6b3dbe25a
commit 9f56ccc496
  1. 5
      azure-pipelines/util/format_diff_lines.pl
  2. 28
      azure-pipelines/util/sample.cpp

@ -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
@ -43,6 +44,10 @@ while (my $line = <STDIN>) {
} 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];
}
}

@ -1,28 +0,0 @@
void foo() {
int bar;
}
class Hi
{
Hi(
) : a(a), b(b)
{
}
int a;
int b; int c; int d;
}
;
void goodFormatting()
{
int a = 0;
int b;
int c;
int d;
if (a) {
while (true) {
b = 1;
}
}
}
Loading…
Cancel
Save