From 4e9df2c552b9ea6212e223e38c8f5d49be3e6d42 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 8 Feb 2020 13:15:39 +0000 Subject: handle git being in a detached head state when getting current commit --- modules/info.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'modules') diff --git a/modules/info.py b/modules/info.py index 8b9ad9e6..db23d068 100644 --- a/modules/info.py +++ b/modules/info.py @@ -4,11 +4,12 @@ from src import IRCBot, ModuleManager, utils class Module(ModuleManager.BaseModule): @utils.hook("received.command.version") def version(self, event): - commit_hash = utils.git_commit(self.bot.directory) + commit = utils.git_commit(self.bot.directory) out = "Version: BitBot %s" % IRCBot.VERSION - if not commit_hash == None: - out = "%s (%s@%s)" % (out, branch, commit_hash) + if not commit == None: + branch, commit = commit + out = "%s (%s@%s)" % (out, branch or "", commit) event["stdout"].write(out) @utils.hook("received.command.source") -- cgit v1.3.1-10-gc9f91