Created
January 20, 2019 05:31
-
-
Save mlbright/d15f4b5bc00ad92face38e9091dbd58a to your computer and use it in GitHub Desktop.
This file contains hidden or 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/env perl | |
use strict; | |
use warnings; | |
use feature qw{ say }; | |
use Getopt::Long; | |
my $options = {}; | |
GetOptions( $options, "--directory=s", "--start=s", "--finish=s" ); | |
my $dir = $options->{directory} || undef; | |
# git --no-pager log --all --name-only --format="%h => [%ct] %ce" | tee /tmp/maya-commits.txt | |
my %commits; | |
my $commit; | |
my $timestamp; | |
while ( my $line = <> ) { | |
chomp $line; | |
if ( $line =~ /^([0-9a-f]{5,40}) => \[(\d+)\]/ ) { | |
$commit = $1; | |
$timestamp = $2; | |
push @{ $commits{$commit} }, []; | |
} | |
else { | |
push @{ $commits{$commit} }, $line; | |
} | |
} | |
my %matches; | |
for my $commit ( keys %commits ) { | |
$matches{$commit} = 0; | |
for my $line ( @{ $commits{$commit} } ) { | |
if ( $line =~ /$dir/ ) { | |
$matches{$commit} = 1; | |
} | |
} | |
} | |
for my $commit ( keys %matches ) { | |
if ( $matches{$commit} ) { | |
say $commit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment