Skip to content

Commit c85db9d

Browse files
committed
Git blame log for some llvm files contains empty user name.
Signed-off-by: Henry Cox <[email protected]>
1 parent 08fe4b5 commit c85db9d

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

scripts/gitblame.pm

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,16 @@ sub annotate
135135
s/\015$//;
136136

137137
if ($line =~
138-
m/^(\S+)[^(]+\(<([^>]+)>\s+([-0-9]+\s+[0-9:]+\s+[-+0-9]+)\s+([0-9]+)\) (.*)$/
138+
m/^(\S+)[^(]+\(<([^>]*)>\s+([-0-9]+\s+[0-9:]+\s+[-+0-9]+)\s+([0-9]+)\) (.*)$/
139139
) {
140140
my $commit = $1;
141-
my $owner = $2;
141+
my $owner = $2; # apparently, this can be empty
142142
my $when = $3;
143143
my $text = $5;
144144

145+
# found empty name in .../clang/include/AST/StmtOpenMP.h
146+
$owner = '[email protected]' unless $owner;
147+
145148
if ($self->[P4]) {
146149
if (!exists($changelists{$commit})) {
147150
if (
@@ -195,13 +198,17 @@ sub annotate
195198
# so use it as a delimiter
196199
push(@lines,
197200
[$text, $owner, $fullname, $when, $commit]);
198-
die("no uniform match$context")
199-
if defined($matched) && !$matched;
201+
# expect all lines to eitehr match the git blame regexp
202+
# or none of them to match
203+
die("$basename has both matching and not matching lines$context"
204+
) if defined($matched) && !$matched;
200205
$matched = 1;
201206
} else {
202207
push(@lines, [$line, "NONE", undef, "NONE", "NONE"]);
203-
die("no uniform match$context")
204-
if defined($matched) && $matched;
208+
# expect all lines to eitehr match the git blame regexp
209+
# or none of them to match
210+
die("$basename has both not matching and matching lines$context"
211+
) if defined($matched) && $matched;
205212
$matched = 0;
206213
}
207214
}

0 commit comments

Comments
 (0)