diff options
author | Daniel Smith <daniel.smith@qt.io> | 2024-03-07 09:28:37 +0100 |
---|---|---|
committer | Daniel Smith <daniel.smith@qt.io> | 2024-03-20 12:15:17 +0000 |
commit | d18cc13199ecb8ad833f759006fdf68b7703878c (patch) | |
tree | 45554b33aea6cbc87b3d4aea38aef18796b9d8f4 /git-hooks | |
parent | 32c787f01b944cd3a1fbb212ee30b5ea23acfa60 (diff) |
Complain if qt_attribution.json is modified without changelog entry
If the qt_attribution.json file is modified without a corresponding
[ChangeLog][Third-Party Code] entry in the commit message, or
vise versa, give a -1 sanity vote.
Task-number: QTQAINFRA-6097
Change-Id: I959e0a0678faaae2578911c1d4ee3dd5d3ca61d8
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Diffstat (limited to 'git-hooks')
-rwxr-xr-x | git-hooks/sanitize-commit | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit index 0d291a6..b01300b 100755 --- a/git-hooks/sanitize-commit +++ b/git-hooks/sanitize-commit @@ -420,6 +420,7 @@ my ($coverity, $cid) = (0, 0); my $msgline = 0; my %picktos = (); my $prevline = ""; +my $changelog3rdparty = 0; open MSG, "git cat-file -p ".$sha1." |" or die "cannot run git: $!"; while (<MSG>) { last if ($_ eq "\n"); @@ -547,6 +548,8 @@ while (<MSG>) { $inchangelog = 1; if (!/^\[ChangeLog\]/ && !defined($cfg{changelog})) { complain_ln("Bad form of [ChangeLog] tag", "changelog"); + } elsif (/\[ChangeLog\]\[Third-Party Code\]/) { + $changelog3rdparty = 1; } } elsif (/^\[[A-Z][- \w]+\]/) { complain_ln("Likely change-log entry without [ChangeLog] tag", "", -1); @@ -813,6 +816,7 @@ my $eof_check; my $ctlkw_check; my $apple_check; my $notobjc_check; +my $attribution_changed; open DIFF, "git diff-tree --minimal --no-commit-id --diff-filter=ACMR --ignore-submodules " . "--src-prefix=\@old\@/ --dst-prefix=\@new\@/ --full-index -r -U100000 --cc -C -l1000 " . "--root ".$sha1." |" or die "cannot run git: $!"; @@ -969,6 +973,12 @@ while (<DIFF>) { } $file = $1; #print "*** got file ".$file.".\n"; + if ($file =~ /qt_attribution\.json$/) { + $attribution_changed = 1; + if (!$changelog3rdparty) { + complain("qt_attribution.json changed without [ChangeLog][Third-Party Code] in the commit message", "changelog"); + } + } $clike = ($file =~ /\.(c|cc|cpp|c\+\+|cxx|qdoc|m|mm|h|hpp|hxx|cs|java|js|qs|qml|g|y|ypp|pl|glsl)$/i); $qmake = ($file =~ /\.pr[filo]$/i); $is_bin = ($file =~ /\.(ps|pdf)$/); @@ -1082,6 +1092,11 @@ while (<DIFF>) { close DIFF; printerr; flushFile(); + +if ($changelog3rdparty && !$attribution_changed) { + complain("[ChangeLog][Third-Party Code] entry without change to qt_attribution.json", "changelog"); +} + if ($mixws_check) { flushChunk() if ($chunk); if ($nonws and $ws) { |