Skip to content

Commit f205495

Browse files
committed
parser: Include extended header lines in diff
Commit 753e457 updated the parser to consider additional header lines when deciding where a patch message ends and the diff begins. However, these additional lines were not captured meaning these patches didn't have a diff associated with them and they therefore weren't patches in the Patchwork sense of the term. Correct this and add a test. Signed-off-by: Stephen Finucane <stephen@that.guru> (cherry picked from commit fc1d750)
1 parent 7b14113 commit f205495

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

patchwork/parser.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,15 @@ def fn(x):
860860
else:
861861
state = 5
862862
elif state == 6:
863-
if line.startswith(('rename to ', 'rename from ',
863+
# extended header lines
864+
# @see https://git-scm.com/docs/git-diff#_generating_patches_with_p
865+
if line.startswith(('old mode ', 'new mode ',
866+
'deleted file mode ',
867+
'new file mode ',
868+
'copy from ', 'copy to ',
869+
'rename from ', 'rename to ',
870+
'similarity index ',
871+
'dissimilarity index ',
864872
'new file mode ', 'index ')):
865873
patchbuf += buf + line
866874
buf = ''
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
From linux-kbuild Sun Apr 07 23:09:09 2019
2+
From: Petr Vorel <pvorel@suse.cz>
3+
Date: Sun, 07 Apr 2019 23:09:09 +0000
4+
To: linux-kbuild
5+
Subject: [PATCH 1/1] kconfig: Make nconf-cfg.sh executable
6+
Message-Id: <20190407230909.20668-1-pvorel@suse.cz>
7+
X-MARC-Message: https://marc.info/?l=linux-kbuild&m=155467856208923
8+
9+
Although it's not required for the build *conf-cfg.sh scripts to be
10+
executable (they're run by CONFIG_SHELL), let's be consistent with other
11+
scripts.
12+
13+
Signed-off-by: Petr Vorel <pvorel@suse.cz>
14+
---
15+
scripts/kconfig/nconf-cfg.sh | 0
16+
1 file changed, 0 insertions(+), 0 deletions(-)
17+
mode change 100644 => 100755 scripts/kconfig/nconf-cfg.sh
18+
19+
diff --git a/scripts/kconfig/nconf-cfg.sh b/scripts/kconfig/nconf-cfg.sh
20+
old mode 100644
21+
new mode 100755
22+
--
23+
2.20.1

patchwork/tests/test_parser.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,11 @@ def test_git_new_empty_file(self):
602602
self.assertTrue(diff is not None)
603603
self.assertTrue(message is not None)
604604

605+
def test_git_mode_change(self):
606+
diff, message = self._find_content('0022-git-mode-change.mbox')
607+
self.assertTrue(diff is not None)
608+
self.assertTrue(message is not None)
609+
605610
def test_cvs_format(self):
606611
diff, message = self._find_content('0007-cvs-format-diff.mbox')
607612
self.assertTrue(diff.startswith('Index'))

0 commit comments

Comments
 (0)