Chicago.PM Report - Scripting Git With Perl

This month's presentation was on the Git::Repository Perl module, given by me. In both my jobs, I use the Git::Repository module to automate releases.

At Double Cluepon, I use it to create the release packages based on tagged commits, so that releasing our software is exactly: git tag vX.X.X && git push --tags. A Perl script builds every package and then pushes them to our update server, where the game will check for a new release.

At Bank of America, we use it to combine our 20-30 Perl distributions into a single release. Using git submodules, we have a "release repository" that holds references to all the modules for each team's releases (some are team-specific, others are shared between teams). A Perl script manages the submodules, determines when the submodule refs need to be updated, tags and branches for each release, and finally builds and installs our modules using Module::Build and local::lib.

All this Git stuff gave me some ideas for possible useful code I can release, perhaps leading to me finally recovering my CPAN ID.

The slides for my Scripting Git With Perl talk

The code for the script that automatically builds releases tagged like "vX.X.X"


Thanks for sharing. Git::Repository seems really nice and useful module

It's so cool to see someone using my module. :-)

In your code, I noted that you used:
my $git = Git::Repository->new( work_tree => '.' );

Actually, in the case when the work tree is the current directory, you can simply do:
my $git = Git::Repository->new();

The idea behind this was that the default use case should behave exactly like git itself.

Regarding your parse_git_log() function, I think you can use the Git::Repository::Plugin::Log plugin to parse the essential elements from the log command and return basic Git::Repository::Log objects.

@BooK: this is an undocumented feature.

The documentation of the constructor says: « At least one of the two parameters is required »

@dolmen: It's actually documented in the tutorial.
I'll rework the documentation to make it more consistent. Thanks.

A great example of why blogging our PM meetings is so important! Feedback from the module author, excellent, thanks @BooK and thanks for the the enjoyable/informative talk @preaction!

Leave a comment

About preaction

user-pic I blog about Perl. I work for Bank of America. I own Double Cluepon Software.