aboutsummaryrefslogtreecommitdiffstats
path: root/difftags
blob: bbc901c4ebc9e1327bf5d4685c7666b91cca59c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# Generates an index of which Vim version introduced a help tag.

if [ $# -ne 1 ]; then
	echo 'Missing required Vim repository argument!' >&2
	exit 1
fi
repo=$1

# Git tags in ascending order of date
tags=$(git -C "$repo" for-each-ref \
	--sort committerdate \
	--format '%(refname:short)' \
	refs/tags)

# Iterate over sliding window of tags
tmp=$(mktemp -d)
mkfifo --mode=0600 "$tmp/p"
printf '\n%s' "$tags" > "$tmp/p" &
for p in $(echo "$tags" | paste --delimiters=: "$tmp/p" -); do
	IFS=: read -r a b << EOF
$p
EOF
	# Find all help tags added with $b
	[ "$b" ] || continue
	# Help tags are defined by placing the name between asterisks (*tag-name*)
	git -C "$repo" diff "${a:-4b825dc642cb6eb9a060e54bf8d69288fbee4904}" "$b" \
		--relative=runtime/doc --diff-filter=AM \
		--unified=0 \
		--word-diff=porcelain --word-diff-regex='\*[^*[:space:]]+\*' \
		| sed --quiet '/^+/s/.*\*\([^*[:space:]]\+\)\*[^*]*/\1\n/gp' \
		| sed -e '/^$/d' -e "s/^/$b\t/"
done \
	| awk '!a[$2]++' # Remove duplicates