summaryrefslogtreecommitdiffstats
path: root/git-hooks
diff options
context:
space:
mode:
authorDaniel Smith <daniel.smith@qt.io>2023-07-10 12:55:08 +0200
committerDaniel Smith <Daniel.Smith@qt.io>2023-07-21 06:30:24 +0000
commit9c5662202d21ed5b472e0bac80fd0a734ee0480e (patch)
tree3934d4c01c8fdcf4eb10e85f633259bdfdf28b10 /git-hooks
parentea67c51fc06fd77e2a133ecffa54cede1bd78c8c (diff)
Handle branch prefixes for pick targets
The sanity bot does not presently handle Pick-to: branch targets when the branch contains a prefix. Since Pick-to: targets are always bare, we should test for the branch including allowed prefixes. Public LTS branches are prefixed with "lts-". TQtC private branches are prefixed with "tqtc/lts-". Change-Id: I31fba92bf39fc92e06f0bf8e0c93ef6874151935 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
Diffstat (limited to 'git-hooks')
-rwxr-xr-xgit-hooks/sanitize-commit10
1 files changed, 9 insertions, 1 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit
index 715956d..8735e15 100755
--- a/git-hooks/sanitize-commit
+++ b/git-hooks/sanitize-commit
@@ -513,7 +513,15 @@ while (<MSG>) {
} elsif (/^Pick-to: *(.*)/i) {
for my $pick (split(/\s+/, $1)) {
$picktos{$pick} = 1;
- if (!defined($allHeads{$pick})) {
+ 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 (!$valid_pick) {
complain_ln("Pick-to entry '$pick' is not a valid branch in $repo",
"pickto", 1);
} elsif (defined($target) && ($pick eq $target)) {