diff options
| author | Stephen Finucane <stephen@that.guru> | 2019-06-04 12:55:38 +0100 |
|---|---|---|
| committer | Stephen Finucane <stephen@that.guru> | 2019-06-04 15:58:05 +0100 |
| commit | fc1d7505991474b07638a87c0834157d12e1e476 (patch) | |
| tree | 0e295b8a0c9fccb849eab52666a0dceec5411d42 | |
| parent | 753e4572d7e8b836daf6087820c49637b3b23602 (diff) | |
| download | patchwork-fc1d7505991474b07638a87c0834157d12e1e476.tar patchwork-fc1d7505991474b07638a87c0834157d12e1e476.tar.gz | |
parser: Include extended header lines in diff
Commit 753e4572d 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>
| -rw-r--r-- | patchwork/parser.py | 10 | ||||
| -rw-r--r-- | patchwork/tests/mail/0022-git-mode-change.mbox | 23 | ||||
| -rw-r--r-- | patchwork/tests/test_parser.py | 5 |
3 files changed, 37 insertions, 1 deletions
diff --git a/patchwork/parser.py b/patchwork/parser.py index a50e3ae..7d7b571 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -851,7 +851,15 @@ def parse_patch(content): else: state = 5 elif state == 6: - if line.startswith(('rename to ', 'rename from ', + # extended header lines + # @see https://git-scm.com/docs/git-diff#_generating_patches_with_p + if line.startswith(('old mode ', 'new mode ', + 'deleted file mode ', + 'new file mode ', + 'copy from ', 'copy to ', + 'rename from ', 'rename to ', + 'similarity index ', + 'dissimilarity index ', 'new file mode ', 'index ')): patchbuf += buf + line buf = '' diff --git a/patchwork/tests/mail/0022-git-mode-change.mbox b/patchwork/tests/mail/0022-git-mode-change.mbox new file mode 100644 index 0000000..bf280bb --- /dev/null +++ b/patchwork/tests/mail/0022-git-mode-change.mbox @@ -0,0 +1,23 @@ +From linux-kbuild Sun Apr 07 23:09:09 2019 +From: Petr Vorel <pvorel@suse.cz> +Date: Sun, 07 Apr 2019 23:09:09 +0000 +To: linux-kbuild +Subject: [PATCH 1/1] kconfig: Make nconf-cfg.sh executable +Message-Id: <20190407230909.20668-1-pvorel@suse.cz> +X-MARC-Message: https://marc.info/?l=linux-kbuild&m=155467856208923 + +Although it's not required for the build *conf-cfg.sh scripts to be +executable (they're run by CONFIG_SHELL), let's be consistent with other +scripts. + +Signed-off-by: Petr Vorel <pvorel@suse.cz> +--- + scripts/kconfig/nconf-cfg.sh | 0 + 1 file changed, 0 insertions(+), 0 deletions(-) + mode change 100644 => 100755 scripts/kconfig/nconf-cfg.sh + +diff --git a/scripts/kconfig/nconf-cfg.sh b/scripts/kconfig/nconf-cfg.sh +old mode 100644 +new mode 100755 +-- +2.20.1 diff --git a/patchwork/tests/test_parser.py b/patchwork/tests/test_parser.py index f182202..c8f8bd9 100644 --- a/patchwork/tests/test_parser.py +++ b/patchwork/tests/test_parser.py @@ -588,6 +588,11 @@ class PatchParseTest(PatchTest): self.assertTrue(diff is not None) self.assertTrue(message is not None) + def test_git_mode_change(self): + diff, message = self._find_content('0022-git-mode-change.mbox') + self.assertTrue(diff is not None) + self.assertTrue(message is not None) + def test_cvs_format(self): diff, message = self._find_content('0007-cvs-format-diff.mbox') self.assertTrue(diff.startswith('Index')) |