| 1 |
#!/bin/bash |
| 2 |
set -euE |
| 3 |
|
| 4 |
REF_BASE=${1:-debian/latest} |
| 5 |
|
| 6 |
REPO=$(git rev-parse --show-toplevel) |
| 7 |
COMMIT_BASE=$(git merge-base --fork-point "$REF_BASE") |
| 8 |
COMMIT_NEW=$(git stash create) |
| 9 |
|
| 10 |
TMP=$(mktemp -d) |
| 11 |
trap "rm -rf '$TMP'" EXIT |
| 12 |
|
| 13 |
function git { |
| 14 |
command git -c advice.detachedHead=false -c init.defaultBranch=main -C "$TMP" "$@" |
| 15 |
} |
| 16 |
|
| 17 |
git init -q |
| 18 |
git remote add origin "$REPO" |
| 19 |
git fetch -q --depth 1 origin $COMMIT_BASE:base $COMMIT_NEW:new |
| 20 |
|
| 21 |
git checkout -q base |
| 22 |
echo "Running gencontrol on ${COMMIT_BASE}" |
| 23 |
( cd "$TMP"; ./debian/bin/gencontrol.py ) |
| 24 |
git stash push -q --all |
| 25 |
|
| 26 |
git checkout -q new |
| 27 |
echo "Running gencontrol on uncommited changes" |
| 28 |
( cd "$TMP"; ./debian/bin/gencontrol.py ) |
| 29 |
git stash push -q --all |
| 30 |
|
| 31 |
# ^3 is the commit with untracked files |
| 32 |
git diff stash@{1}^3 stash@{0}^3 -- . ':(exclude)debian/lib/python/debian_linux/__pycache__/*' |