#!/bin/sh
# 91-cz.cn self-authored teaching example, version 0.1.0, MIT.
# Uses a new temporary repository; never changes an existing checkout.
set -eu
ledger_dir=$(mktemp -d)
trap 'rm -rf "$ledger_dir"' EXIT HUP INT TERM
cd "$ledger_dir"
git init -q
git config user.name 'Teaching Example'
git config user.email 'teaching@91-cz.cn'
printf '0.1.0\n' > VERSION
git add VERSION
git -c core.hooksPath=/dev/null commit -qm 'Teaching version 0.1.0'
git tag teaching-0.1.0
printf '0.2.0\n' > VERSION
git add VERSION
git -c core.hooksPath=/dev/null commit -qm 'Teaching version 0.2.0'
printf 'tag_commit='
git rev-parse 'teaching-0.1.0^{commit}'
printf 'head_commit='
git rev-parse HEAD
printf 'tag_version='
git show teaching-0.1.0:VERSION
printf 'head_version='
git show HEAD:VERSION
printf 'signature_status=not signed; lightweight teaching tag\n'
