From: Randal L. Schwartz Date: Fri, 24 Feb 2006 19:06:08 GMT Subject: Re: git-annotate efficiency Message-ID: <86oe0wbmqn.fsf@blue.stonehenge.com> In-Reply-To: <118833cc0602241000p4e4c8017u3e3afe76fbbd75a4@mail.gmail.com> >>>>> "Morten" == Morten Welinder writes: Morten> It looks like handle_rev is seeing the same revisions over and over again. Morten> I don't know why that would be, but the following patch just skips dups. Morten> I have no idea if it is right, though. Morten> Morten Morten> diff --git a/git-annotate.perl b/git-annotate.perl Morten> index 3800c46..a5e2d86 100755 Morten> --- a/git-annotate.perl Morten> +++ b/git-annotate.perl Morten> @@ -117,7 +117,10 @@ sub init_claim { Morten> sub handle_rev { Morten> my $i = 0; Morten> + my %seen = (); Morten> while (my $rev = shift @revqueue) { Morten> + next if $seen{$rev}; Morten> + $seen{$rev} = 1; Morten> my %revinfo = git_commit_info($rev); The traditional idiom for that is next if $seen{$rev}++; -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!