Created
September 2, 2016 15:12
-
-
Save choroba/d70a31d65d66f9a64f411db21c8931c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings; | |
use strict; | |
use feature qw{ say }; | |
use Time::Piece; | |
open my $GIT, '-|', qw{ git log --name-status --reverse }; | |
my $date; | |
my %last_touched; | |
while (<$GIT>) { | |
if (my ($date_string) = /^Date:\s+(.*)/) { | |
$date = 'Time::Piece' | |
->strptime($date_string, '%a %b %d %H:%M:%S %Y %z')->epoch; | |
} elsif (my ($file) = /^[ACDMRTUXB]\s+(.*)/) { | |
$last_touched{$file} = $date | |
if $file =~ /\.(?:p[lm]|pwt|t)$/ && -f $file; | |
} | |
} | |
for my $file ( | |
sort { $last_touched{$b} <=> $last_touched{$a} } keys %last_touched | |
) { | |
say $file; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment