Skip to content

Instantly share code, notes, and snippets.

@fukata
Created January 10, 2012 02:53
Show Gist options
  • Save fukata/1586585 to your computer and use it in GitHub Desktop.
Save fukata/1586585 to your computer and use it in GitHub Desktop.
sorted commiter date git tags.
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use autodie;
sub validate_show_lines {
my ( $show ) = @_;
return @$show[0] =~ /^tag .*$/;
}
my $tags = {};
my @revs = `git rev-parse --tags`;
foreach my $rev ( @revs ) {
my @show = `git show --format=format:%ct $rev`;
if ( validate_show_lines(\@show) ) {
my ( $tag ) = $show[0] =~ /^tag (.*)$/;
$tags->{$show[5]} = {
tag => $tag,
message => $show[3],
};
}
else {
my @show = `git show --format=format:%d::%ct::%s $rev`;
my ( $tag, $timestamp, $message ) = $show[0] =~ /^ \((.*)\)\:\:(.*)\:\:(.*)$/;
$tags->{$timestamp} = {
tag => $tag,
message => $message . "\n",
};
}
}
my @sorted_keys = sort keys %$tags;
### $tags
### @sorted_keys
foreach my $key ( @sorted_keys ) {
print $tags->{$key}->{tag}."\t".$tags->{$key}->{message};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment