We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9088d97 commit 79c2392Copy full SHA for 79c2392
git-force-mtimes
@@ -0,0 +1,20 @@
1
+#!/usr/bin/perl
2
+# Sets mtimes of all files in the reprository their last change date
3
+# based on git's log. Useful to avoid too new dates after a
4
+# checkout.
5
+
6
+my %seen;
7
+my $date;
8
+open(LOG, "git log --pretty=format:'date: %ct' --name-only |") || die "git log failed: $!";
9
+while (<LOG>) {
10
+ chomp;
11
+ if (/^date: (\d+)$/) {
12
+ $date=$1;
13
+ }
14
+ elsif (! /^$/ && ! $seen{$_}) {
15
+ $seen{$_}=1;
16
+ # git log can list deleted files, so error is ignored
17
+ utime($date, $date, $_);
18
19
+}
20
+close LOG || die "git log failed: $!";
0 commit comments