X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/90c98cdc39f640a14fb31e330d9297887926283a..7f2591eaea2208c2bdc55eb66df3fd3734d45c96:/support/git-set-file-times diff --git a/support/git-set-file-times b/support/git-set-file-times index 9ddef25f..077ac0e0 100755 --- a/support/git-set-file-times +++ b/support/git-set-file-times @@ -1,5 +1,6 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl use strict; +use warnings; # Sets mtime and atime of files to the latest commit time in git. # @@ -8,6 +9,7 @@ use strict; my %ls; my $commit_time; +my $prefix = @ARGV && $ARGV[0] =~ s/^--prefix=// ? shift : ''; $/ = "\0"; open FH, 'git ls-files -z|' or die $!; @@ -27,6 +29,7 @@ while () { my @files = delete @ls{split(/\0/, $_)}; @files = grep { defined $_ } @files; next unless @files; + map { s/^/$prefix/ } @files; utime $commit_time, $commit_time, @files; } last unless %ls;