Skip to content

Commit

Permalink
Only rename default branch if it is not master
Browse files Browse the repository at this point in the history
The issue here is that renaming a branch in an empty repository will
fail with earlier versions of git (e.g. 2.25), where the default branch
is always master anyways.
  • Loading branch information
Aratz committed Nov 22, 2022
1 parent 4395637 commit a890a63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def setUp(self):
self.create_obj.init_pipeline()
self.remote_path = os.path.join(self.tmp_dir, "remote_repo")
self.remote_repo = git.Repo.init(self.remote_path, bare=True)
self.remote_repo.active_branch.rename(default_branch)

if self.remote_repo.active_branch.name != "master":
self.remote_repo.active_branch.rename(default_branch)

def tearDown(self):
if os.path.exists(self.tmp_dir):
Expand Down

0 comments on commit a890a63

Please sign in to comment.