set -u
export MSYS_NO_PATHCONV=1
S="$(cygpath -m "$TEMP")/ir147b-real"; rm -rf "$S"; mkdir -p "$S"
REPO="file://$(cygpath -m /c/Users/decid/Documents/projects/spt-core)"
OLD="$S/old.py"; git show origin/main:.github/ci/classify-changes.py > "$OLD"
NEW="$(cygpath -m "$(pwd)")/.github/ci/classify-changes.py"
C=c185326bd2b08e152cc33aa975fcea2240ca1cc8; A=9aa011ac8267d8110986448bd6a111a58220b54c
mk() {
  d="$S/$1"; git init -q "$d"; git -C "$d" remote add origin "$REPO"
  git -C "$d" fetch -q --no-tags --depth=2 origin $C
  git -C "$d" fetch -q --no-tags --depth=2 origin $A
  git -C "$d" checkout -q --detach $A
  echo "== $1: c185 present=$(git -C "$d" cat-file -e $C^{commit} && echo y || echo n) 0854bbe8 parents=[$(git -C "$d" rev-list --parents -n1 0854bbe8 | cut -c42-)] is-ancestor-exit=$(git -C "$d" merge-base --is-ancestor $C $A; echo $?) shallow=$(git -C "$d" rev-parse --is-shallow-repository)"
}
mk old; (cd "$S/old" && GITHUB_EVENT_NAME=push GITHUB_SHA=$A CLASSIFY_BEFORE=$C CLASSIFY_FORCED=false python "$OLD" | tail -1)
mk new; (cd "$S/new" && GITHUB_EVENT_NAME=push GITHUB_SHA=$A CLASSIFY_BEFORE=$C CLASSIFY_FORCED=false python "$NEW" | tail -1)
echo "new, after its deepen: is-ancestor-exit=$(git -C "$S/new" merge-base --is-ancestor $C $A; echo $?)"
