From a48f904fea457d33eb8f7297469945fe3c05e4c1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Jan 2009 22:35:39 -0500 Subject: [PATCH] fix handling of repos w/o titles --- webcheckout | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/webcheckout b/webcheckout index 9467c9d..1238172 100755 --- a/webcheckout +++ b/webcheckout @@ -152,21 +152,26 @@ sub better { sub dedup { my %seenhref; my %bytitle; + my @others; foreach my $repo (@_) { if (exists $repo->{title} && - length $repo->{title} && - exists $bytitle{$repo->{title}}) { - my $other=$bytitle{$repo->{title}}; - next unless better($repo, $other); - delete $bytitle{$other->{title}} + length $repo->{title}) { + if (exists $bytitle{$repo->{title}}) { + my $other=$bytitle{$repo->{title}}; + next unless better($repo, $other); + delete $bytitle{$other->{title}} + } + + if (! $seenhref{$repo->{href}}++) { + $bytitle{$repo->{title}}=$repo; + } } - - if (! $seenhref{$repo->{href}}++) { - $bytitle{$repo->{title}}=$repo; + else { + push @others, $repo; } } - return values %bytitle; + return values %bytitle, @others; } sub parse { -- 2.39.5