Updating git integration to account for detached HEAD: Also updating tests
This commit is contained in:
parent
4454eb7fce
commit
5acc09d88c
2 changed files with 8 additions and 6 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
from resource import error
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from evennia import CmdSet, InterruptCommand
|
from evennia import CmdSet, InterruptCommand
|
||||||
from evennia.utils.utils import list_to_string
|
from evennia.utils.utils import list_to_string
|
||||||
|
|
@ -43,7 +44,12 @@ class GitCommand(MuxCommand):
|
||||||
raise InterruptCommand
|
raise InterruptCommand
|
||||||
|
|
||||||
self.commit = self.repo.head.commit
|
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):
|
def short_sha(self, repo, hexsha):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -75,11 +75,7 @@ class TestGitIntegration(EvenniaTest):
|
||||||
|
|
||||||
class TestGitEvennia(BaseEvenniaCommandTest):
|
class TestGitEvennia(BaseEvenniaCommandTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
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.")
|
|
||||||
self.commit = self.repo.head.commit
|
self.commit = self.repo.head.commit
|
||||||
self.branch = self.repo.active_branch.name
|
self.branch = self.repo.active_branch.name
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue