diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit
index 4863902476b8299e20727d13b27a21586a670163..11e48cfc2971c4ef1e74dae8ee2584cddcf049f0 100755
--- a/git-hooks/sanitize-commit
+++ b/git-hooks/sanitize-commit
@@ -323,8 +323,13 @@ sub styleFail($)
     push @style_fails, $lineno.": ".$why;
 }
 
+my $no_copyright = 0;
+
 sub flushFile()
 {
+    if ($no_copyright) {
+        &complain("Missing copyright header", "copyright");
+    }
     if (@style_fails) {
         &complain("Style issues", "style", -1);
         for my $sf (@style_fails) {
@@ -357,8 +362,11 @@ while (<DIFF>) {
         }
         next;
     }
-    if ($lineno < 50 && $check_gen) {
-        if (/All changes made in this file will be lost|This file is automatically generated|DO NOT EDIT|DO NOT delete this file|[Gg]enerated by|uicgenerated|produced by gperf/) {
+    if ($lineno < 50) {
+        if ($no_copyright && /Copyright/) {
+            $no_copyright = 0;
+        }
+        if ($check_gen && /All changes made in this file will be lost|This file is automatically generated|DO NOT EDIT|DO NOT delete this file|[Gg]enerated by|uicgenerated|produced by gperf/) {
             &complain("Adding generated file", "generated") if ($new_file && !defined($cfg{generated}));
             $ws_check = 0;
             $check_gen = 0;
@@ -455,6 +463,7 @@ while (<DIFF>) {
             $conflict_fail = defined($cfg{conflict});
             $braces = 0;
             $check_gen = 0;
+            $no_copyright = 0;
             next;
         }
         if ($maybe_bin && /^Binary files /) {
@@ -496,6 +505,7 @@ while (<DIFF>) {
                 }
                 $size = 0;
                 $new_file = 1;
+                $no_copyright = $issrc;
             } elsif ($size > 20000 && !$issrc && !defined($cfg{size})) {
                 my $old_size = 0;
                 for my $old_tree (split(/,/, $old_trees)) {