test: specify default git branch

don't assume that master is the default branch name.

Signed-off-by: Caleb Connolly <kc@postmarketos.org>
Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230629-suffix-type-hint-v1-3-e92802ae20a8@postmarketos.org%3E
This commit is contained in:
Caleb Connolly 2023-07-12 23:09:09 +01:00 committed by Oliver Smith
parent d32be64820
commit 78b78410a4
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 7 additions and 7 deletions

View File

@ -35,16 +35,16 @@ def prepare_tmpdir(args, monkeypatch, tmpdir):
def run_git(git_args, repo="local"):
path = tmpdir + "/" + repo
pmb.helpers.run.user(args, ["git"] + git_args, path, "stdout")
pmb.helpers.run.user(args, ["git"] + git_args, path, "stdout", output_return=True)
# Remote repos
run_git(["init", "."], "remote")
run_git(["init", "-b", "master", "."], "remote")
run_git(["commit", "--allow-empty", "-m", "commit: remote"], "remote")
run_git(["init", "."], "remote2")
run_git(["init", "-b", "master", "."], "remote2")
run_git(["commit", "--allow-empty", "-m", "commit: remote2"], "remote2")
# Local repo (with master -> origin2/master)
run_git(["init", "."])
run_git(["init", "-b", "master", "."])
run_git(["remote", "add", "-f", "origin", path_remote])
run_git(["remote", "add", "-f", "origin2", path_remote2])
run_git(["checkout", "-b", "master", "--track", "origin2/master"])

View File

@ -44,7 +44,7 @@ def test_can_fast_forward(args, tmpdir):
pmb.helpers.run.user(args, ["git"] + git_args, tmpdir, "stdout")
# Create test git repo
run_git(["init", "."])
run_git(["init", "-b", "master", "."])
run_git(["commit", "--allow-empty", "-m", "commit on master"])
run_git(["checkout", "-b", branch_origin])
run_git(["commit", "--allow-empty", "-m", "commit on branch_origin"])
@ -71,7 +71,7 @@ def test_clean_worktree(args, tmpdir):
pmb.helpers.run.user(args, ["git"] + git_args, tmpdir, "stdout")
# Create test git repo
run_git(["init", "."])
run_git(["init", "-b", "master", "."])
run_git(["commit", "--allow-empty", "-m", "commit on master"])
assert func(args, tmpdir) is True
@ -98,7 +98,7 @@ def test_get_upstream_remote(args, monkeypatch, tmpdir):
pmb.helpers.run.user(args, ["git"] + git_args, tmpdir, "stdout")
# Create git repo
run_git(["init", "."])
run_git(["init", "-b", "master", "."])
run_git(["commit", "--allow-empty", "-m", "commit on master"])
# No upstream remote