diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2022-04-25 17:27:28 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2022-05-03 13:28:09 +0000 |
commit | 10d4124a82b1c52dbd35639e20895bb111b58245 (patch) | |
tree | 22620928fd66cb8b8c4ddab2083bb3f45c6f6bc5 | |
parent | 447398a2d6f357bc381ea8464faec6226f2cfe97 (diff) | |
download | qtrepotools-10d4124a82b1c52dbd35639e20895bb111b58245.tar.gz |
Leave sanitize-commit's $target undefined when no branch is given
It was previously unconditionally set, either to false or to the
branch passed on the command line; but code tests it using
defined($target), which was thus always true. Apparently the intent
was to leave it undefined when no branch was given.
Exposed by configuring my local repositories for picked modules to
have with-pickbot enabled. This script is used as post-commit hook,
passing only one argument, without the extra arguments the Qt Sanity
bot on Gerrit passes, notably the one that supplies $target's value.
The with-pickbot code thus got exercised in a new way, leading to a
bogus warning.
Change-Id: If4e035300d6017a7398e995be96e3dee2a0969ed
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
-rwxr-xr-x | git-hooks/sanitize-commit | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit index cc757ae..b84e1ab 100755 --- a/git-hooks/sanitize-commit +++ b/git-hooks/sanitize-commit @@ -1,5 +1,5 @@ #! /usr/bin/perl -# Copyright (C) 2017 The Qt Company Ltd. +# Copyright (C) 2022 The Qt Company Ltd. # Copyright (C) 2014 Petroules Corporation. # Contact: http://www.qt.io/licensing/ # @@ -23,7 +23,7 @@ my $sha1 = $ARGV[0]; my $gerrit_rest = ($#ARGV >= 1 && $ARGV[1] eq "gerrit-rest"); my $strict = $gerrit_rest || ($#ARGV >= 1 && $ARGV[1] eq "strict"); my $instance = ($#ARGV >= 2) ? $ARGV[2] : "default"; -my $target = $#ARGV == 3 && $ARGV[3]; +my $target = $#ARGV == 3 ? $ARGV[3] : undef; my $repo = getcwd(); $repo =~ s,/?\.git$,,; |