Bug 277078 - Kompare does not work well with git patches
Summary: Kompare does not work well with git patches
Status: CONFIRMED
Alias: None
Product: kompare
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Kompare developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-04 16:55 UTC by Konstantin Tokarev
Modified: 2011-07-05 10:00 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Tokarev 2011-07-04 16:55:02 UTC
Version:           unspecified (using Devel) 
OS:                Linux

When opening git pathc, Kompare shows error "The diff is malformed. Some lines could not be parsed and will not be displayed in the diff view." 

Also, Kompare shows dummy a/ and b/ prefixes as directories.

Also, Kompare recognizes git patches as "application/mbox" files, and MIME-type-based logic does not work for them ("text/x-patch" is expected)

Reproducible: Didn't try

Steps to Reproduce:
Open any git patch

Actual Results:  
Error about malformed patch is shown. Git patch is not visualized in optimal way

Expected Results:  
Better support for git patches
Comment 1 Kevin Kofler 2011-07-05 09:40:54 UTC
Yes, the check for diff validity is still too strict, even after the fix for bug #249976. :-(
Comment 2 Konstantin Tokarev 2011-07-05 09:42:19 UTC
I think it should work the next way:

1) If file is recognized  as "application/mbox"? search for "diff --git" inside. If found, strip "mail" part and parse remaining diff
Comment 3 Kevin Kofler 2011-07-05 09:45:57 UTC
I don't think the mail prefix is what's causing the "malformed" warning, it's some other non-diff junk, probably the git version at the end.
Comment 4 Konstantin Tokarev 2011-07-05 10:00:32 UTC
If so, strip everything outside "---" guards:

<Mail header>
---
<Actual patch here>
---
<git version>