git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: GNU diff and git diff - difference on myers algorithm?

From
JKJacob Keller <jacob.keller-re5jqeeqqe8avxtiumwx3w@public.gmane.org>
Date
Jul 17, 2015, 04:23 UTC
Message-ID
<CA+P7+xq=J76N16XETKkUhRJKyShPtg4-K0aMjE5+_LzBJQ-t3A@mail.gmail.com>
In-Reply-To
<CA+P7+xrOPS6NeQhte-ATdm2Nqo0PpmUAxS+XYzWDvZGtwPtWMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Thu, Jul 16, 2015 at 9:22 PM, Jacob Keller <jacob.keller-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Show 43 quoted lines
> On Thu, Jul 16, 2015 at 12:07 PM, Luis R. Rodriguez
> <mcgrof-3uybbJdB1yH774rrrx3eTA@public.gmane.org> wrote:
>> On Fri, Jun 12, 2015 at 11:52 AM, Luis R. Rodriguez
>> <mcgrof-3uybbJdB1yH774rrrx3eTA@public.gmane.org> wrote:
>>> OK wells I'm curious about more research / effort when trying to
>>> evaluate a diff with two seprate but adjoining preprocessor directives
>>> and if anyone has implemented an optimizaiton option to let the diff
>>> generator join them.
>>>
>>> For example, to let it infer that:
>>>
>>> --- a/test.c
>>> +++ b/test.c
>>> @@ -10,8 +10,6 @@ int main(int argc, char *argv[])
>>>
>>>  #ifdef FOO
>>>         a = 4;
>>> -#endif /* FOO */
>>> -#ifdef FOO
>>>         a = 5;
>>>  #endif /* FOO */
>>>
>>> is possible.
>>
>> Anyone familiar if any tool exists today that would optimize this? Is
>> anyone working on it? Would git be a good place for such a thing? I'd
>> consider it as an option to optimize a diff. This for example is
>> extremely useful for us working with Coccinelle where we have a tool
>> writing code for us, while such an optimization might be useful to
>> Coccinelle it would seem like a rather generic feature, its just not
>> clear to me where to give such a tool a proper home.
>>
>>  Luis
>
> I do not understand exactly what would be optimized in this case?
>
> In any regards, that's not a diff transformation, that is a code
> transformation, and I would suggest starting with Coccinelle and
> seeing if you can get that to do what you want.
> http://coccinelle.lip6.fr/
>
> Regards,
> Jake

I misread your comment. Coccinelle is a tool that could probably be coerced into doing this, but this is not a diff optimization unless I am completely understanding it. This is a code transformation concept, and doesn't have much to do with finding differences or code changes. My above comment is correct, but I don't think this belongs in diff parsing, but rather as part of something like Coccinelle

Regards, Jake

Previous: Jacob Keller
Message 6 of 6 in “GNU diff and git diff - difference on myers algorithm?”
  1. Luis R. RodriguezJun 8, 2015
  2. Johannes SchindelinJun 9, 2015
  3. Luis R. RodriguezJun 12, 2015
  4. Luis R. RodriguezJul 16, 2015
  5. Jacob KellerJul 17, 2015
  6. Jacob KellerJul 17, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.