Skip to content

Commit 039be2e

Browse files
authored
build: improve patch filename remembering (electron#23070) (electron#23184)
1 parent fb6f604 commit 039be2e

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
@@ -7,10 +7,12 @@ def read_patch(patch_dir, patch_filename):
77
"""Read a patch from |patch_dir/filename| and amend the commit message with
88
metadata about the patch file it came from."""
99
ret = []
10+
added_filename_line = False
1011
with open(os.path.join(patch_dir, patch_filename)) as f:
1112
for l in f.readlines():
12-
if l.startswith('diff -'):
13+
if not added_filename_line and (l.startswith('diff -') or l.startswith('---')):
1314
ret.append('Patch-Filename: {}\n'.format(patch_filename))
15+
added_filename_line = True
1416
ret.append(l)
1517
return ''.join(ret)
1618

0 commit comments

Comments
 (0)