Git::R...erator(3pm)
π Git::Repository::Log::Iterator β the manual, but make it cute
okay bestie, welcome to Git::Repository::Log::Iterator(3pm) π
this one's a Perl module page from the User Contributed Perl Documentation, and it's literally the little machine that takes a big ol' git log stream and β¨ chops it into records β¨ for you.
πΈ NAME πΈ
Git::Repository::Log::Iterator β split a git log stream into records. that's it, that's the whole job, and she does it flawlessly no cap π
β¨ SYNOPSIS β¨
use Git::Repository::Log::Iterator;
# use a default Git::Repository context
my $iter = Git::Repository::Log::Iterator->new('HEAD~10..');
# or provide an existing instance
my $iter = Git::Repository::Log::Iterator->new( $r, 'HEAD~10..' );
# get the next log record
while ( my $log = $iter->next ) {
...;
}
look at her go π¦ two ways to spin her up, one little while loop, and you're eating good.
π DESCRIPTION π
Git::Repository::Log::Iterator kicks off a git log command from a list of parameters and then parses the output to produce Git::Repository::Log objects, one per log item. it's giving factory energy, honestly π
π METHODS π
π new
my $iter = Git::Repository::Log::Iterator->new( @args );
creates a brand new git log stream from the parameter list in @args and hands you back an iterator on top of it. slay.
new() will happily accept any parameters β she's not picky β but heads up: Git::Repository::Log::Iterator expects the output to look like the output of --pretty=raw, so she forces the --pretty option, just in case format.pretty is defined in the Git configuration. and she also forcibly removes colored output with --color=never. no rainbow logs here, sorry, she needs it plain π§
extra output (like patches) gets stashed in the extra parameter of the Git::Repository::Log object. decorations? lost. gone. rip πͺ¦
and if new() spots unsupported options in the parameter list, she will croak() at you with a message advising you to use run( 'log' => ... ) and parse the output yourself. she's not mad, she's just setting a boundary π
the object is really just a blessed hash reference with only two keys:
cmdβ theGit::Repository::Commandobject running the actualgit logcommand. it might not be defined in some cases (see below,new_from_fhandnew_from_file).fhβ the filehandle from which the output ofgit logis actually read. this is the only attribute needed to run thenextmethod.
π new_from_fh
this constructor makes it possible to provide the filehandle directly. you bring the fh, she brings the parsing π«Ά
the cmd key is not defined when you use this constructor.
π new_from_file
this constructor makes it possible to provide a filename that will be open()ed to produce a filehandle, so you can read the log stream from it.
the cmd key is not defined when you use this constructor either. same vibe, different input.
β next
my $log = $iter->next;
returns the next log item as a Git::Repository::Log object β or nothing at all if the stream has ended. periodt. π«
π COPYRIGHT π
Copyright 2010-2016 Philippe Bruhat (BooK), all rights reserved.
π LICENSE π
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
ok that's the whole page, bestie, you're officially fluent in log iteration π§β¨
and that's a wrap on this lil readme β this cutie came to you via perl v5.34.0, dated 2022-06-14, under the name Git::R...erator(3pm). mwah π go split some streams.
π¦ where this page comes from
- debian bookworm: libgit-repository-plugin-log-perl 1.314-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libgit-repository-plugin-log-perl 1.314-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libgit-repository-plugin-log-perl 1.314-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libgit-repository-plugin-log-perl 1.314-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libgit-repository-plugin-log-perl 1.314-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms