From 897be4cc1a77f506e47f66e6130c22cee14edbd1 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 26 Sep 2021 14:56:38 +0200 Subject: [PATCH] also work if no commit is present --- InvenTree/plugins/integration.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/InvenTree/plugins/integration.py b/InvenTree/plugins/integration.py index 974f6fa49e..846d1738a4 100644 --- a/InvenTree/plugins/integration.py +++ b/InvenTree/plugins/integration.py @@ -164,6 +164,11 @@ def get_git_log(path): path = path.replace(os.path.dirname(settings.BASE_DIR), '')[1:] command = ['git', 'log', '-n', '1', "--pretty=format:'%H%n%aN%n%aE%n%aI%n%f%n%G?%n%GK'", '--follow', '--', path] try: + output = str(subprocess.check_output(command, cwd=os.path.dirname(settings.BASE_DIR)), 'utf-8')[1:-1] + if output: + output = output.split('\n') + else: + output = 7 * [''] except subprocess.CalledProcessError: output = 7 * [''] return {'hash': output[0], 'author': output[1], 'mail': output[2], 'date': output[3], 'message': output[4], 'verified': output[5], 'key': output[6]}