summaryrefslogtreecommitdiffstats
path: root/scripts/update_timestamps.sh
blob: 9e1dc2ea47d8b0d8402ded6a212911e1c035fa2b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
#
# (C) Copyright 2022, Alejandro Colomar
# SPDX-License-Identifier:  GPL-3.0-only
#
# Update the timestamp of the manual pages modified since the last git
# tag, with the date of the latest commit that modifies that page.
#
#######################################################################


git diff --name-only $(git describe --abbrev=0)..HEAD \
|xargs find 2>/dev/null \
|while read f; do
	date="$(git log --format=%ci -1 -- $f | cut -f1 -d' ')";

	awk "/^\.TH/ {\$4 = \"$date\"} {print}" <$f \
	|sponge $f;
done;