]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Scripts/PatchCheck.py
BaseTools/PatchCheck.py: Ignore CR and LF characters in subject length
[mirror_edk2.git] / BaseTools / Scripts / PatchCheck.py
index 6aec15d0f0b23bd58c13efac5b0ecf3c5457f36e..9668025798da2ba0a3523ad3bb3b017a348b2343 100755 (executable)
@@ -196,7 +196,7 @@ class CommitMessageCheck:
             self.error('Empty commit message!')\r
             return\r
 \r
-        if count >= 1 and len(lines[0]) >= 72:\r
+        if count >= 1 and len(lines[0].rstrip()) >= 72:\r
             self.error('First line of commit message (subject line) ' +\r
                        'is too long.')\r
 \r
@@ -270,6 +270,7 @@ class GitDiffCheck:
             if line.startswith('@@ '):\r
                 self.state = PRE_PATCH\r
             elif len(line) >= 1 and line[0] not in ' -+' and \\r
+                 not line.startswith('\r\n') and  \\r
                  not line.startswith(r'\ No newline ') and not self.binary:\r
                 for line in self.lines[self.line_num + 1:]:\r
                     if line.startswith('diff --git'):\r
@@ -313,6 +314,8 @@ class GitDiffCheck:
                 pass\r
             elif line.startswith('+'):\r
                 self.check_added_line(line[1:])\r
+            elif line.startswith('\r\n'):\r
+                pass\r
             elif line.startswith(r'\ No newline '):\r
                 pass\r
             elif not line.startswith(' '):\r
@@ -328,6 +331,8 @@ class GitDiffCheck:
         'old mode ',\r
         'new mode ',\r
         'similarity index ',\r
+        'copy from ',\r
+        'copy to ',\r
         'rename ',\r
         )\r
 \r
@@ -538,7 +543,7 @@ class CheckGitCommits:
 \r
     def read_patch_from_git(self, commit):\r
         # Run git to get the commit patch\r
-        return self.run_git('show', '--pretty=email', commit)\r
+        return self.run_git('show', '--pretty=email', '--no-textconv', commit)\r
 \r
     def run_git(self, *args):\r
         cmd = [ 'git' ]\r