summaryrefslogtreecommitdiff
path: root/fixdates.sh
blob: b71a112a0b27b80c11c37ac805f10e884d27f94a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash 
 
thisdir="$(cd "$(dirname "$0")";pwd)"
cd "${1:-$thisdir}"
git ls-files -z | \
while read -d $'\0' filename; do
    date="$(git log -n 1 --pretty='format:%ct' -- "$filename")"
    if [[ -n "$date" ]]; then
        echo "updating <$filename> to date <$date>"
        touch -d @"$date" "$filename"
    fi
done