#!/bin/sh
#
# Test suite needs upstream git repo.
# Modelled after .github/workflows/pythonpackage.yml
#
# The tests need patching as well. Thus, this script will produce errors,
# but it is a starting point to catch issues with patches.

set -ex

cd "$AUTOPKGTEST_TMP"

git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git config --global protocol.file.allow always

test -d GitPython || git clone https://github.com/gitpython-developers/GitPython.git
cd GitPython
git reset --hard "$(dpkg-query -W -f '${source:Upstream-Version}' python3-git)"
# Make sure we test the package.
rm -r git doc
git submodule update --init --recursive

#sed -i '/addopts/d' pyproject.toml

for py in $(py3versions -s); do
    $py -m pytest test/ || :
done
