Git fuzzy patch compare

Mauro Carvalho Chehab mchehab at redhat.com
Thu Feb 11 12:44:37 EST 2010


martin f krafft wrote:
> also sprach Mauro Carvalho Chehab <mchehab at redhat.com> [2010.02.11.1259 +1300]:
>>>> For a replacement patch, you may try to use an algorithm like
>>>> what -git does: get only the diff and compare the previous and
>>>> the new version. If they are very close, you may consider the
>>>> reply as a replacement.
>>> How does Git do this?
>> I never look at -git source code where this check is done, but, as
>> the source code is available and well written, I think it
>> shouldn't be hard to port it to patchwork.
> 
> I don't even know what (Git) feature you are speaking of.
> 

If you rename a file and change some lines, or if you do a major change 
in a file, git has an algorithm to autodetect it.

For example:

 1 files changed, 126 insertions(+), 85 deletions(-)
 rewrite format_waiting_patches.pl (75%)

It works based on a configurable threshold between the two file
versions. If we use it to compare the two diffs in a reply, if they
are 100% identical, the old patch may automatically be marked as
superseed. If they aren't 100% identical, yet patchwork could provide
a hint to the maintainer that the patch were likely superseded by
a newer one (for example, if the diffs are 80% identical).

-- 

Cheers,
Mauro


More information about the Patchwork mailing list