mirror of
https://github.com/obra/superpowers
synced 2026-07-10 12:44:29 +00:00
38 lines
1.0 KiB
Bash
38 lines
1.0 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Generate a task review package: commit list, stat summary, and the net
|
||
|
|
# diff with extended context, written to a file the reviewer reads in one
|
||
|
|
# call. Using the recorded per-task BASE (not HEAD~1) keeps multi-commit
|
||
|
|
# tasks intact.
|
||
|
|
#
|
||
|
|
# Usage: review-package BASE HEAD OUTFILE
|
||
|
|
# Example: review-package a1b2c3d HEAD /tmp/sdd-task-3.diff
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
if [ $# -ne 3 ]; then
|
||
|
|
echo "usage: review-package BASE HEAD OUTFILE" >&2
|
||
|
|
exit 2
|
||
|
|
fi
|
||
|
|
|
||
|
|
base=$1
|
||
|
|
head=$2
|
||
|
|
out=$3
|
||
|
|
|
||
|
|
git rev-parse --verify --quiet "$base" >/dev/null || { echo "bad BASE: $base" >&2; exit 2; }
|
||
|
|
git rev-parse --verify --quiet "$head" >/dev/null || { echo "bad HEAD: $head" >&2; exit 2; }
|
||
|
|
|
||
|
|
{
|
||
|
|
echo "# Review package: ${base}..${head}"
|
||
|
|
echo
|
||
|
|
echo "## Commits"
|
||
|
|
git log --oneline "${base}..${head}"
|
||
|
|
echo
|
||
|
|
echo "## Files changed"
|
||
|
|
git diff --stat "${base}..${head}"
|
||
|
|
echo
|
||
|
|
echo "## Diff"
|
||
|
|
git diff -U10 "${base}..${head}"
|
||
|
|
} > "$out"
|
||
|
|
|
||
|
|
commits=$(git rev-list --count "${base}..${head}")
|
||
|
|
echo "wrote ${out}: ${commits} commit(s), $(wc -c < "$out" | tr -d ' ') bytes"
|