Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use strict;
- use File::Basename;
- use Digest::SHA;
- use File::Copy;
- my $files;
- while (<>) {
- chomp;
- my @line = split(/ /, $_, 8);
- my ($name,$path) = fileparse($line[7]);
- open (my $fh, '<', $path . $name) or die "$!";
- my $sha = Digest::SHA->new('sha1');
- $sha->addfile($fh);
- push(@{$files->{$name}->{$sha->hexdigest}}, [ $line[7], $line[5] ] );
- }
- for my $file (sort keys %$files) {
- for my $hash (sort keys %{$files->{$file}}) {
- copy($files->{$file}->{$hash}[0][0], '.') or die $!;
- my $commitMessage;
- for (@{$files->{$file}->{$hash}}) {
- $commitMessage .= ( join("\t", @$_, ) . "\n" );
- }
- system('git', 'add', $file);
- system('git', 'commit', '-m', $commitMessage);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement