From 802fa62e0341efb12378b7005ce62de6be8e5416 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 3 May 2020 12:41:05 +0000 Subject: [PATCH] Don't convert post if it doesn't contain a commit hash --- git.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/git.py b/git.py index 3c5ff6817..3e5493adc 100644 --- a/git.py +++ b/git.py @@ -116,15 +116,16 @@ def convertPostToCommit(baseDir: str, nickname: str, domain: str, postJsonObject['object']['content'], False): return False + patchStr = gitFormatContent(postJsonObject['object']['content']) + commitHash = getGitHash(patchStr) + if not commitHash: + return False postJsonObject['object']['type'] = 'Commit' # add a commitedBy parameter if not postJsonObject['object'].get('committedBy'): postJsonObject['object']['committedBy'] = \ postJsonObject['object']['attributedTo'] - patchStr = gitFormatContent(postJsonObject['object']['content']) - commitHash = getGitHash(patchStr) - if commitHash: - postJsonObject['object']['hash'] = commitHash + postJsonObject['object']['hash'] = commitHash postJsonObject['object']['description'] = { "mediaType": "text/plain", "content": patchStr