]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Scripts/PatchCheck.py
BaseTools/Scripts/PatchCheck.py: Remove submodule false positives
[mirror_edk2.git] / BaseTools / Scripts / PatchCheck.py
index 173d4517e0a80d5e62b12c1c9b9b798e567f7d58..6823cc69bb9f84d1dce476f3258031c9d9ed1f2a 100755 (executable)
@@ -341,7 +341,21 @@ class GitDiffCheck:
                 self.state = PRE_PATCH\r
                 self.filename = line[13:].split(' ', 1)[0]\r
                 self.is_newfile = False\r
-                self.force_crlf = not self.filename.endswith('.sh')\r
+                self.force_crlf = True\r
+                self.force_notabs = True\r
+                if self.filename.endswith('.sh'):\r
+                    #\r
+                    # Do not enforce CR/LF line endings for linux shell scripts.\r
+                    #\r
+                    self.force_crlf = False\r
+                if self.filename == '.gitmodules':\r
+                    #\r
+                    # .gitmodules is updated by git and uses tabs and LF line\r
+                    # endings.  Do not enforce no tabs and do not enforce\r
+                    # CR/LF line endings.\r
+                    #\r
+                    self.force_crlf = False\r
+                    self.force_notabs = False\r
             elif len(line.rstrip()) != 0:\r
                 self.format_error("didn't find diff command")\r
             self.line_num += 1\r
@@ -355,6 +369,11 @@ class GitDiffCheck:
                 self.binary = True\r
                 if self.is_newfile:\r
                     self.new_bin.append(self.filename)\r
+            elif line.startswith('new file mode 160000'):\r
+                #\r
+                # New submodule.  Do not enforce CR/LF line endings\r
+                #\r
+                self.force_crlf = False\r
             else:\r
                 ok = False\r
                 self.is_newfile = self.newfile_prefix_re.match(line)\r
@@ -429,7 +448,7 @@ class GitDiffCheck:
         if self.force_crlf and eol != '\r\n':\r
             self.added_line_error('Line ending (%s) is not CRLF' % repr(eol),\r
                                   line)\r
-        if '\t' in line:\r
+        if self.force_notabs and '\t' in line:\r
             self.added_line_error('Tab character used', line)\r
         if len(stripped) < len(line):\r
             self.added_line_error('Trailing whitespace found', line)\r