getpatchwork / patchwork

Patchwork is a web-based patch tracking system designed to facilitate the contribution and management of contributions to an open-source project.
http://jk.ozlabs.org/projects/patchwork/
GNU General Public License v2.0
277 stars 82 forks source link

Parser confused when commit message line starts with "diff" #462

Open steadmon opened 2 years ago

steadmon commented 2 years ago

Example here: https://patchwork.kernel.org/project/git/patch/a4320f2fcf35f180e1c585be4105194f1555a874.1650448612.git.gitgitgadget@gmail.com/

It looks like Patchwork treats the first line matching /^diff/ as the start of the patch, even if that line is actually part of the commit message.

stephenfin commented 2 years ago

This is obviously a bug, but fixing this is going to be tricky. It's tough to find a heuristic that reliably works here unfortunately, at least in a VCS independent manner. I wonder how git-am would fare with this...

daxtens commented 2 years ago

Another complexity is that we still support CVS diffs. If you look at the state machine in the parser code, you'll see that a line starting with diff moves us into a new state, but we don't have code to move us back out into regular comment state - it just keeps accumulating until it finds the 'real' start to the diff. That's probably what we need to fix.

stephenfin commented 2 years ago

Yeah, we might want to look at splitting out the parsing logic into something Git specific (git-format-patch generated) and something more generic