All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gitweb: ignore lines from diff-tree which do not match the expected format
@ 2006-08-06 15:55 Matthias Lederhofer
  2006-08-06 15:59 ` [PATCH] gitweb: Skip nonmatching lines in difftree output, consistently Jakub Narebski
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Lederhofer @ 2006-08-06 15:55 UTC (permalink / raw)
  To: git

The sha1 on the first line of git diff-tree -r --root sha1 does not
match the expected format and produces warnings.

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
 gitweb/gitweb.perl |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1f4b0f5..b0da0ea 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1772,7 +1772,9 @@ sub git_tree {
 	my $alternate = 0;
 	foreach my $line (@entries) {
 		#'100644	blob	0fa3f3a66fb6a137f6ec2c19351ed4d807070ffa	panic.c'
-		$line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/;
+		if (!($line =~ m/^([0-9]+) (.+) ([0-9a-fA-F]{40})\t(.+)$/)) {
+			next;
+		}
 		my $t_mode = $1;
 		my $t_type = $2;
 		my $t_hash = $3;
@@ -2163,7 +2165,9 @@ sub git_commitdiff {
 	foreach my $line (@difftree) {
 		# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M      ls-files.c'
 		# ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M      rev-tree.c'
-		$line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/;
+		if (!($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)\t(.*)$/)) {
+			next;
+		}
 		my $from_mode = $1;
 		my $to_mode = $2;
 		my $from_id = $3;
-- 
1.4.1.gfd699

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-06 17:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-06 15:55 [PATCH] gitweb: ignore lines from diff-tree which do not match the expected format Matthias Lederhofer
2006-08-06 15:59 ` [PATCH] gitweb: Skip nonmatching lines in difftree output, consistently Jakub Narebski
2006-08-06 16:01   ` Jakub Narebski
2006-08-06 17:24   ` [PATCH] gitweb: fix commitdiff_plain for root commits Matthias Lederhofer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.