Re: git-annotate efficiency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> "Morten" == Morten Welinder <mwelinder@xxxxxxxxx> 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
<merlyn@xxxxxxxxxxxxxx> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]