diff options
author | Oswald Buddenhagen <oswald.buddenhagen@gmx.de> | 2020-05-07 23:57:29 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@gmx.de> | 2020-05-12 14:27:20 +0000 |
commit | b4d7abe9eb7018b2013bc23371d7d2454a73c598 (patch) | |
tree | b5ac7788080762b3715057657fdcb00c934a7642 /git-hooks | |
parent | db7851a1351d7cc499e327dde6222eb19e24fe85 (diff) | |
download | qtrepotools-b4d7abe9eb7018b2013bc23371d7d2454a73c598.tar.gz |
re-nest conditions
this is clearer, and a tiny bit faster.
Change-Id: I2bb0608876d18fa1241091abfbf940732c39d953
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'git-hooks')
-rwxr-xr-x | git-hooks/sanitize-commit | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit index ab176ff..16e4120 100755 --- a/git-hooks/sanitize-commit +++ b/git-hooks/sanitize-commit @@ -456,17 +456,6 @@ while (<MSG>) { } elsif ($cherry) { $cherry = 0 if (/\)/); } else { - if (/^Reviewed-by:/i) { - $badrev = $lineno; - } elsif (/^Signed-off-by:/i) { - $badsign = $lineno; - } elsif (/^Task-number: *(.*)/i) { - complain_ln("Multiple tasks in one footer", "") if ($1 =~ /,/); - complain_ln("Capitalization of \"Task-number\" is wrong", "") if (!/^Task-number:/); - } elsif (/^Fixes: *(.*)/i) { - complain_ln("Multiple tasks in one footer", "") if ($1 =~ /,/); - complain_ln("Capitalization of \"Fixes\" is wrong", "") if (!/^Fixes:/); - } my $ftr = 0; if (/^\((?:partial(?:ly)? )?(?:cherry[- ]pick|(?:back-?)?port)(?:ed)?(?: from| of)?(?: commit)? (\w+\/)?([[:xdigit:]]{7,40})/) { if (!$1) { @@ -485,6 +474,16 @@ while (<MSG>) { $inchangelog = 0; if (/^Change-?Log:/i) { complain_ln("Use [ChangeLog] tag instead", "changelog") if (!defined($cfg{changelog})); + } elsif (/^Reviewed-by:/i) { + $badrev = $lineno; + } elsif (/^Signed-off-by:/i) { + $badsign = $lineno; + } elsif (/^Task-number: *(.*)/i) { + complain_ln("Multiple tasks in one footer", "") if ($1 =~ /,/); + complain_ln("Capitalization of \"Task-number\" is wrong", "") if (!/^Task-number:/); + } elsif (/^Fixes: *(.*)/i) { + complain_ln("Multiple tasks in one footer", "") if ($1 =~ /,/); + complain_ln("Capitalization of \"Fixes\" is wrong", "") if (!/^Fixes:/); } } elsif (/^\[change-?log\]/i) { $inchangelog = 1; |