tests: adjust create_repo() to keep working on OLDER git

Commit 6d42388f20
("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 <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2021-08-05 11:50:03 -07:00 committed by Marti Bolivar
parent f69c734662
commit a2ab08a3c9
1 changed files with 5 additions and 1 deletions

View File

@ -307,7 +307,11 @@ def create_repo(path, initial_branch='master'):
path]) path])
else: else:
subprocess.check_call([GIT, 'init', path]) 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) cwd=path)
config_repo(path) config_repo(path)