git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-annotate efficiency

From
Randal L. Schwartz <merlyn@stonehenge.com>
Date
Feb 24, 2006, 19:06 UTC
Message-ID
<86oe0wbmqn.fsf@blue.stonehenge.com>
In-Reply-To
<118833cc0602241000p4e4c8017u3e3afe76fbbd75a4@mail.gmail.com>
>>>>> "Morten" == Morten Welinder <mwelinder@gmail.com> 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@stonehenge.com> <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!
Previous: Morten WelinderNext: Ryan Anderson
Message 3 of 4 in “git-annotate efficiency”
  1. Morten WelinderFeb 24, 2006
  2. Morten WelinderFeb 24, 2006
  3. Randal L. SchwartzFeb 24, 2006
  4. Ryan AndersonFeb 24, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.