From 43a8fc09e89e3b71cbbb2559b4c8180c85f4e7c9 Mon Sep 17 00:00:00 2001 From: Rob Browning Date: Sat, 4 Sep 2021 15:43:02 -0500 Subject: [PATCH] test_git: be independent of user's git defaultBranch Signed-off-by: Rob Browning Tested-by: Rob Browning --- test/int/test_git.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/int/test_git.py b/test/int/test_git.py index 0b114f1..95e8671 100644 --- a/test/int/test_git.py +++ b/test/int/test_git.py @@ -255,8 +255,9 @@ def test_commit_parsing(tmpdir): environ[b'GIT_AUTHOR_EMAIL'] = b'bup@a425bc70a02811e49bdf73ee56450e6f' environ[b'GIT_COMMITTER_EMAIL'] = environ[b'GIT_AUTHOR_EMAIL'] try: - readpipe([b'git', b'init', workdir]) environ[b'GIT_DIR'] = environ[b'BUP_DIR'] = repodir + readpipe([b'git', b'init', workdir]) + exc(b'git', b'symbolic-ref', b'HEAD', b'refs/heads/main') git.check_repo_or_die(repodir) os.chdir(workdir) with open('foo', 'w') as f: @@ -265,7 +266,7 @@ def test_commit_parsing(tmpdir): readpipe([b'git', b'commit', b'-am', b'Do something', b'--author', b'Someone ', b'--date', b'Sat Oct 3 19:48:49 2009 -0400']) - commit = readpipe([b'git', b'show-ref', b'-s', b'master']).strip() + commit = readpipe([b'git', b'show-ref', b'-s', b'main']).strip() parents = showval(commit, b'%P') tree = showval(commit, b'%T') cname = showval(commit, b'%cn') @@ -292,7 +293,7 @@ def test_commit_parsing(tmpdir): f.write(b'baz\n') readpipe([b'git', b'add', '.']) readpipe([b'git', b'commit', b'-am', b'Do something else']) - child = readpipe([b'git', b'show-ref', b'-s', b'master']).strip() + child = readpipe([b'git', b'show-ref', b'-s', b'main']).strip() parents = showval(child, b'%P') commit_items = git.get_commit_items(child, git.cp()) WVPASSEQ(commit_items.parents, [commit]) -- 2.39.2