diff options
author | Daniel Smith <daniel.smith@qt.io> | 2024-03-15 11:46:11 +0100 |
---|---|---|
committer | Daniel Smith <daniel.smith@qt.io> | 2024-03-18 12:31:49 +0000 |
commit | 32c787f01b944cd3a1fbb212ee30b5ea23acfa60 (patch) | |
tree | 3a66d63ef26974c9dc63cce5aadcb2496f565a22 | |
parent | 130826c46e393ce5a07140533cf5c75b6d583836 (diff) |
Ignore branch validity for LTS release branch targets in public repos
Since LTS release branches may not exist in the public repo,
sanitize-commit cannot validate Pick-to: targets for them when
evaluating public commits. This change bypasses the branch
validation check for release targets to known LTS branches.
In the event that the target branch is not a valid branch in the end,
the cherry-pick bot will simply fail to perform the requested pick
and post an error message to the change, alerting the author.
Fixes: QTQAINFRA-6191
Change-Id: Id87b9e6fd379ad741801f339d42c13dca1f51123
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rwxr-xr-x | git-hooks/sanitize-commit | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit index 344518b..0d291a6 100755 --- a/git-hooks/sanitize-commit +++ b/git-hooks/sanitize-commit @@ -517,12 +517,18 @@ while (<MSG>) { } elsif (/^Pick-to: *(.*)/i) { for my $pick (split(/\s+/, $1)) { $picktos{$pick} = 1; - my @pick_alternatives = ($pick, "lts-$pick", "tqtc/lts-$pick"); my $valid_pick = 0; - foreach my $pick_alt (@pick_alternatives) { - if (defined($allHeads{$pick_alt})) { - $valid_pick = 1; - last; + if ($repo !~ /\/tqtc-/ && $pick =~ /^(\d+\.\d+)\.\d+$/ + && grep { $_ eq $1 } @LTS) { + # Bypass validity check for LTS release branch pick in public repos + $valid_pick = 1; + } else { + my @pick_alternatives = ($pick, "lts-$pick", "tqtc/lts-$pick"); + foreach my $pick_alt (@pick_alternatives) { + if (defined($allHeads{$pick_alt})) { + $valid_pick = 1; + last; + } } } if (!$valid_pick) { |