Updating git integration to account for detached HEAD: Also updating tests

This commit is contained in:
Wendy Wang 2022-10-10 21:37:41 +02:00
parent 4454eb7fce
commit 5acc09d88c
2 changed files with 8 additions and 6 deletions

View file

@ -1,3 +1,4 @@
from resource import error
from django.conf import settings
from evennia import CmdSet, InterruptCommand
from evennia.utils.utils import list_to_string
@ -43,7 +44,12 @@ class GitCommand(MuxCommand):
raise InterruptCommand
self.commit = self.repo.head.commit
self.branch = self.repo.active_branch.name
try:
self.branch = self.repo.active_branch.name
except TypeError as type_err:
self.caller.msg(type_err)
raise InterruptCommand
def short_sha(self, repo, hexsha):
"""

View file

@ -75,11 +75,7 @@ class TestGitIntegration(EvenniaTest):
class TestGitEvennia(BaseEvenniaCommandTest):
def setUp(self):
super().setUp()
try:
self.repo = git.Repo(settings.EVENNIA_DIR, search_parent_directories=True)
except git.exc.InvalidGitRepositoryError:
print("Test TestGitEvennia failed, unable to find Evennia directory.")
super().setUp()
self.commit = self.repo.head.commit
self.branch = self.repo.active_branch.name