gitweb: Skip nonmatching lines in difftree output, consistently
This fixes error for commitdiff on root commit (without parents). Noticed-by: Matthias Lederhofer (matled) Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Jakub Narebski committed
Aug 6, 2006 at 17:59 UTC
e349d21ab47ae4a3753749c4579cce150c71c768
1 file changed
+7
-3
gitweb/gitweb.perl
+7
-3
@@ -1983,7 +1983,7 @@ sub git_commit {
1983
foreach my $line (@difftree) {
1984
# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M ls-files.c'
1985
# ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M rev-tree.c'
1986
- if (!($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/)) {
1986
+ if ($line !~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/) {
1987
next;
1988
}
1989
my $from_mode = $1;
@@ -2156,7 +2156,9 @@ sub git_commitdiff {
2156
foreach my $line (@difftree) {
2157
# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M ls-files.c'
2158
# ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M rev-tree.c'
2159
- $line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/;
2159
+ if ($line !~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/) {
2160
+ next;
2161
+ }
2162
my $from_mode = $1;
2163
my $to_mode = $2;
2164
my $from_id = $3;
@@ -2230,7 +2232,9 @@ sub git_commitdiff_plain {
2232
print "---\n\n";
2233
2234
foreach my $line (@difftree) {
2233
- $line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/;
2235
+ if ($line !~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/) {
2236
+ next;
2237
+ }
2238
my $from_id = $3;
2239
my $to_id = $4;
2240
my $status = $5;