summaryrefslogtreecommitdiffstats
path: root/git-hooks/gerrit-bot
diff options
context:
space:
mode:
authorDaniel Smith <daniel.smith@qt.io>2020-07-10 10:04:26 +0200
committerDaniel Smith <Daniel.Smith@qt.io>2020-07-10 13:52:21 +0000
commit717165804ffc82ab73e1e2b886bd0b0899a5013d (patch)
tree0729ae2f3eb1a9165b6c38e40852506f8df6526d /git-hooks/gerrit-bot
parent7d4c8b82348a8ef2efb7772d16e0b575051a683e (diff)
Gerrit-bot: Fix use of uninitialized variable when no sanity-review
If the Sanity-bot subprocess fails to generate a suitable output with the 'Sanity-Review' label, gerrit-bot restarts the process repeatedly, spamming the change in gerrit. Check for the uninitialized variable so the warning isn't thrown. Task-number: QTQAINFRA-3841 Change-Id: I9950e3242bc043d9d986f9e046d53a6ba1fecf17 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'git-hooks/gerrit-bot')
-rwxr-xr-xgit-hooks/gerrit-bot3
1 files changed, 2 insertions, 1 deletions
diff --git a/git-hooks/gerrit-bot b/git-hooks/gerrit-bot
index c65f262..8c3b684 100755
--- a/git-hooks/gerrit-bot
+++ b/git-hooks/gerrit-bot
@@ -225,7 +225,8 @@ sub process_commit($$$$$)
}
$$verdict{tag} = 'autogenerated:sanity';
my $hasComments = defined $$verdict{comments} && %{$$verdict{comments}};
- if ($$verdict{labels}{'Sanity-Review'} == 1 && !$hasComments) {
+ if (defined $$verdict{labels}{'Sanity-Review'}
+ && $$verdict{labels}{'Sanity-Review'} == 1 && !$hasComments) {
# Don't spam everyone about a boring +1 sanity review with no comments.
$$verdict{notify} = "NONE";
}