From 0e106be1dc6d52ce14f1291ac1ec1149007f918c Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 16 Oct 2024 20:55:00 +0200 Subject: generate post info using git --- _scripts/postinfo | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 _scripts/postinfo (limited to '_scripts/postinfo') diff --git a/_scripts/postinfo b/_scripts/postinfo new file mode 100755 index 0000000..95fe872 --- /dev/null +++ b/_scripts/postinfo @@ -0,0 +1,21 @@ +#!/bin/sh +file="$1" +tab="$(printf '\t')" + +history="$(git log \ + --follow \ + --ignore-all-space --diff-filter=AM \ + --date=short --pretty=format:"%cd$tab%an" \ + -- "$file")" + +dates="$(echo "$history" | cut -d"$tab" -f1)" +authors="$(echo "$history" | cut -d"$tab" -f2 | sort -u)" + +cat << EOF +date: $(echo "$dates" | head -n1) +date_initial: $(echo "$dates" | tail -n1) +edits: $(echo "$dates" | wc -l) +authors: +$(echo "$authors" | sed 's/^/- /') +EOF + -- cgit v1.2.3