Skip to content

Commit 9055048

Browse files
authored
build: improve patch filename remembering (electron#23070)
1 parent 5154e8f commit 9055048

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

script/lib/patches.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ def read_patch(patch_dir, patch_filename):
88
"""Read a patch from |patch_dir/filename| and amend the commit message with
99
metadata about the patch file it came from."""
1010
ret = []
11+
added_filename_line = False
1112
patch_path = os.path.join(patch_dir, patch_filename)
1213
with codecs.open(patch_path, encoding='utf-8') as f:
1314
for l in f.readlines():
14-
if l.startswith('diff -'):
15+
if not added_filename_line and (l.startswith('diff -') or l.startswith('---')):
1516
ret.append('Patch-Filename: {}\n'.format(patch_filename))
17+
added_filename_line = True
1618
ret.append(l)
1719
return ''.join(ret)
1820

0 commit comments

Comments
 (0)