Files
h-school/tools/embed-changelog.sh
Leonid PershinandCursor 449be4e0ea Show unseen Server commits after login.
Bake first-parent git log at Server build and remember the SHA in a browser cookie.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-20 11:43:36 +03:00

24 lines
608 B
Bash

#!/bin/sh
# UTF-8 first-parent log for HSchool.Server. Keep in sync with embed-changelog.ps1.
set -e
RepoRoot=$1
Output=$2
if [ -z "$RepoRoot" ] || [ -z "$Output" ]; then
echo "usage: embed-changelog.sh <repo-root> <output>" >&2
exit 1
fi
mkdir -p "$(dirname "$Output")"
sha=
log=
if sha=$(git -C "$RepoRoot" rev-parse HEAD 2>/dev/null) && [ "${#sha}" -eq 40 ]; then
log=$(git -C "$RepoRoot" -c core.quotepath=false log --first-parent --encoding=UTF-8 --pretty=format:%H%x1f%cI%x1f%s) || log=
else
sha=
fi
{
printf '%s\n' "$sha"
if [ -n "$log" ]; then
printf '%s\n' "$log"
fi
} > "$Output"