For a patch file that:
1. Contains a binary change
2. Contains any other changes after the binary change
PatchCheck.py will complains with the following error:
* Patch format error: diff found after end of patch
Line: literal XXXX
This commit resolves this misreport.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
## @file\r
# Check a patch for various format issues\r
#\r
## @file\r
# Check a patch for various format issues\r
#\r
-# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials are licensed and made\r
# available under the terms and conditions of the BSD License which\r
#\r
# This program and the accompanying materials are licensed and made\r
# available under the terms and conditions of the BSD License which\r
if line.startswith('@@ '):\r
self.state = PRE_PATCH\r
elif len(line) >= 1 and line[0] not in ' -+' and \\r
if line.startswith('@@ '):\r
self.state = PRE_PATCH\r
elif len(line) >= 1 and line[0] not in ' -+' and \\r
- not line.startswith(r'\ No newline '):\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
self.format_error('diff found after end of patch')\r
for line in self.lines[self.line_num + 1:]:\r
if line.startswith('diff --git'):\r
self.format_error('diff found after end of patch')\r
elif self.state == PATCH:\r
if self.binary:\r
pass\r
elif self.state == PATCH:\r
if self.binary:\r
pass\r
- if line.startswith('-'):\r
+ elif line.startswith('-'):\r
pass\r
elif line.startswith('+'):\r
self.check_added_line(line[1:])\r
pass\r
elif line.startswith('+'):\r
self.check_added_line(line[1:])\r