Skip to content

Commit

Permalink
build: improve patch filename remembering (#23070)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Apr 20, 2020
1 parent 9a058fb commit 765f1ca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion script/lib/patches.py
Expand Up @@ -7,10 +7,12 @@ def read_patch(patch_dir, patch_filename):
"""Read a patch from |patch_dir/filename| and amend the commit message with
metadata about the patch file it came from."""
ret = []
added_filename_line = False
with open(os.path.join(patch_dir, patch_filename)) as f:
for l in f.readlines():
if l.startswith('diff -'):
if not added_filename_line and (l.startswith('diff -') or l.startswith('---')):
ret.append('Patch-Filename: {}\n'.format(patch_filename))
added_filename_line = True
ret.append(l)
return ''.join(ret)

Expand Down

0 comments on commit 765f1ca

Please sign in to comment.