xref: /freebsd/sys/contrib/openzfs/scripts/man-dates.sh (revision 3ff01b231dfa83d518854c63e7c9cd1debd1139e)
1eda14cbcSMatt Macy#!/bin/sh
2eda14cbcSMatt Macy
3eda14cbcSMatt Macy# This script updates the date lines in the man pages to the date of the last
4eda14cbcSMatt Macy# commit to that file.
5eda14cbcSMatt Macy
6eda14cbcSMatt Macyset -eu
7eda14cbcSMatt Macy
8eda14cbcSMatt Macyfind man -type f | while read -r i ; do
9eda14cbcSMatt Macy    git_date=$(git log -1 --date=short --format="%ad" -- "$i")
10*3ff01b23SMartin Matuska    [ -z "$git_date" ] && continue
11eda14cbcSMatt Macy    sed -i "s|^\.Dd.*|.Dd $(date -d "$git_date" "+%B %-d, %Y")|" "$i"
12eda14cbcSMatt Macydone
13