diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2010-04-16 12:21:44 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2010-04-16 12:23:28 -0400 |
commit | 6c5c0f8c682a2727bb71652668fef90a40d99f25 (patch) | |
tree | 69aa73b41869f5e8ca41b3d3c73838d73198d9e6 | |
parent | 49be30eae88b4a027becc3e67bc321e0bf89840f (diff) |
add mtime-to-git script to pull more correct mtimes out of git
-rwxr-xr-x | mtime-to-git | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mtime-to-git b/mtime-to-git new file mode 100755 index 000000000..9875af5d7 --- /dev/null +++ b/mtime-to-git @@ -0,0 +1,14 @@ +#!/bin/sh +# Sets mtimes of all files in the tree their last change date +# based on git's log. Useful to avoid too new dates after a +# fresh checkout, which lead to ikiwiki unnecessarily rebuilding +# basewiki files on upgrade. +if [ -d .git ]; then + for file in $(git ls-files); do + date="$(git log -1 --date=rfc "$file" | grep ^Date: | sed -e 's/Date://')" + if [ -n "$date" ]; then + echo "$date $file" + touch -d"$date" $file + fi + done +fi |