From a2ab08a3c940dc8755fe30ddc1ac4980dcfa94dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Thu, 5 Aug 2021 11:50:03 -0700 Subject: [PATCH] tests: adjust create_repo() to keep working on OLDER git MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 6d42388f20959723eae1781537c7090a9600599d ("tests: adjust create_repo() to keep working on newer git") got tox working again in Arch on my laptop, and in CI for whatever GitHub decides to use for ubuntu-latest, but it breaks tox on my Ubuntu 20.04 LTS testing environment that I use for release testing. Fix it, again, and hopefully for the last time. See comments in the source code for details on the fix. Signed-off-by: Martí Bolívar --- tests/conftest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index ce896a5..9539038 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -307,7 +307,11 @@ def create_repo(path, initial_branch='master'): path]) else: subprocess.check_call([GIT, 'init', path]) - subprocess.check_call([GIT, 'checkout', '-b', initial_branch], + # -B instead of -b because on some versions of git (at + # least 2.25.1 as shipped by Ubuntu 20.04), if 'git init path' + # created an 'initial_branch' already, we get errors that it + # already exists with plain '-b'. + subprocess.check_call([GIT, 'checkout', '-B', initial_branch], cwd=path) config_repo(path)