{"thread":{"id":"44520","subject":"Feature request: Improve diff algorithm","startedAt":"2016-11-21T08:18:57Z","lastAt":"2018-01-30T18:26:48Z","messageCount":13,"participants":["KES","Jacob Keller","Stefan Beller","SZEDER Gábor","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"306212","messageId":"14657461479715884@web21h.yandex.ru","threadId":"44520","inReplyTo":null,"subject":"Feature request: Improve diff algorithm","fromName":"KES","fromEmail":"kes-kes@yandex.ru","sentAt":"2016-11-21T08:11:24Z","receivedAt":"2016-11-21T08:18:57Z","isPatch":false,"sender":{"key":"kes-kes@yandex.ru","avatar":null},"body":"Hi.\n\nI have some question about how diff works then give proposal:\n\nit will be very useful for each \"symbol\" store additional meta info as source line length. So in this case when git counter two equal sequence of commands it will do further comparison: Adds 23 chars deletes none VS adds 75 chars deletes 46\n\nActually I got this:\n\n@@ -129,8 +132,9 @@ sub _preprocess_message {\n sub _process_message {\n     my ($self, $message) = @_;\n\n-    my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n+    my $time =  [ gettimeofday ];\n\n+    my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n     return $self->send_error(ERROR_REQUEST_INVALID)\n         unless defined($method);\n\nInstead of expected:\n@@ -129,6 +132,8 @@ sub _preprocess_message {\n sub _process_message {\n     my ($self, $message) = @_;\n\n+    my $time =  [ gettimeofday ];\n+\n     my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n-     \n     return $self->send_error(ERROR_REQUEST_INVALID)\n\n\nDetails: http://stackoverflow.com/questions/40550751/unexpected-result-in-git-diff/40552165?noredirect=1#comment68648377_40552165\n"},{"id":"306220","messageId":"CA+P7+xrKfqOb-3FhKxXdnF6g9PktNWNzY+ZnHJS=yuVo1YdXzg@mail.gmail.com","threadId":"44520","inReplyTo":"14657461479715884@web21h.yandex.ru","subject":"Re: Feature request: Improve diff algorithm","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2016-11-21T16:56:44Z","receivedAt":"2016-11-21T16:57:10Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Mon, Nov 21, 2016 at 12:11 AM, KES <kes-kes@yandex.ru> wrote:\n> Hi.\n>\n\nHi,\n\n> I have some question about how diff works then give proposal:\n>\n> it will be very useful for each \"symbol\" store additional meta info as source line length. So in this case when git counter two equal sequence of commands it will do further comparison: Adds 23 chars deletes none VS adds 75 chars deletes 46\n>\n> Actually I got this:\n>\n> @@ -129,8 +132,9 @@ sub _preprocess_message {\n>  sub _process_message {\n>      my ($self, $message) = @_;\n>\n> -    my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n> +    my $time =  [ gettimeofday ];\n>\n> +    my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n>      return $self->send_error(ERROR_REQUEST_INVALID)\n>          unless defined($method);\n>\n> Instead of expected:\n> @@ -129,6 +132,8 @@ sub _preprocess_message {\n>  sub _process_message {\n>      my ($self, $message) = @_;\n>\n> +    my $time =  [ gettimeofday ];\n> +\n>      my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n> -\n>      return $self->send_error(ERROR_REQUEST_INVALID)\n>\n\nHave you tried the various options for git to search for smaller\ndiffs? Or using the other diff algorithms such as histogram instead of\npatience?\n\nThanks,\nJake\n"},{"id":"306227","messageId":"CAGZ79kZbGPneUXVEqJYhQAn+dfYve7qCjhO7QFaV1JBs3HD1aA@mail.gmail.com","threadId":"44520","inReplyTo":"CA+P7+xrKfqOb-3FhKxXdnF6g9PktNWNzY+ZnHJS=yuVo1YdXzg@mail.gmail.com","subject":"Re: Feature request: Improve diff algorithm","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-11-21T18:17:49Z","receivedAt":"2016-11-21T18:17:55Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Nov 21, 2016 at 8:56 AM, Jacob Keller <jacob.keller@gmail.com> wrote:\n> On Mon, Nov 21, 2016 at 12:11 AM, KES <kes-kes@yandex.ru> wrote:\n>> Hi.\n>>\n>\n> Hi,\n>\n>> I have some question about how diff works then give proposal:\n>>\n>> it will be very useful for each \"symbol\" store additional meta info as source line length. So in this case when git counter two equal sequence of commands it will do further comparison: Adds 23 chars deletes none VS adds 75 chars deletes 46\n>>\n>> Actually I got this:\n>>\n>> @@ -129,8 +132,9 @@ sub _preprocess_message {\n>>  sub _process_message {\n>>      my ($self, $message) = @_;\n>>\n>> -    my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n>> +    my $time =  [ gettimeofday ];\n>>\n>> +    my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n>>      return $self->send_error(ERROR_REQUEST_INVALID)\n>>          unless defined($method);\n>>\n>> Instead of expected:\n>> @@ -129,6 +132,8 @@ sub _preprocess_message {\n>>  sub _process_message {\n>>      my ($self, $message) = @_;\n>>\n>> +    my $time =  [ gettimeofday ];\n>> +\n>>      my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n>> -\n>>      return $self->send_error(ERROR_REQUEST_INVALID)\n>>\n>\n> Have you tried the various options for git to search for smaller\n> diffs? Or using the other diff algorithms such as histogram instead of\n> patience?\n>\n\nThe newest version of Git comes with a flag to move around the diff\nbetter, based on the work at https://github.com/mhagger/diff-slider-tools\n"},{"id":"306232","messageId":"CA+P7+xqMUPLC-aKW-fiS629_Owat8sCa5vp_bOwQTO8LP4hCzw@mail.gmail.com","threadId":"44520","inReplyTo":"CAGZ79kZbGPneUXVEqJYhQAn+dfYve7qCjhO7QFaV1JBs3HD1aA@mail.gmail.com","subject":"Re: Feature request: Improve diff algorithm","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2016-11-21T18:55:34Z","receivedAt":"2016-11-21T18:56:00Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Mon, Nov 21, 2016 at 10:17 AM, Stefan Beller <sbeller@google.com> wrote:\n> On Mon, Nov 21, 2016 at 8:56 AM, Jacob Keller <jacob.keller@gmail.com> wrote:\n>> On Mon, Nov 21, 2016 at 12:11 AM, KES <kes-kes@yandex.ru> wrote:\n>>> Hi.\n>>>\n>>\n>> Hi,\n>>\n>>> I have some question about how diff works then give proposal:\n>>>\n>>> it will be very useful for each \"symbol\" store additional meta info as source line length. So in this case when git counter two equal sequence of commands it will do further comparison: Adds 23 chars deletes none VS adds 75 chars deletes 46\n>>>\n>>> Actually I got this:\n>>>\n>>> @@ -129,8 +132,9 @@ sub _preprocess_message {\n>>>  sub _process_message {\n>>>      my ($self, $message) = @_;\n>>>\n>>> -    my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n>>> +    my $time =  [ gettimeofday ];\n>>>\n>>> +    my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n>>>      return $self->send_error(ERROR_REQUEST_INVALID)\n>>>          unless defined($method);\n>>>\n>>> Instead of expected:\n>>> @@ -129,6 +132,8 @@ sub _preprocess_message {\n>>>  sub _process_message {\n>>>      my ($self, $message) = @_;\n>>>\n>>> +    my $time =  [ gettimeofday ];\n>>> +\n>>>      my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n>>> -\n>>>      return $self->send_error(ERROR_REQUEST_INVALID)\n>>>\n>>\n>> Have you tried the various options for git to search for smaller\n>> diffs? Or using the other diff algorithms such as histogram instead of\n>> patience?\n>>\n>\n> The newest version of Git comes with a flag to move around the diff\n> better, based on the work at https://github.com/mhagger/diff-slider-tools\n\nUnfortunately in this case, I'm not convinced that it will improve the\ndiff. It's worth a try as well though.\n\nThanks,\nJake\n"},{"id":"337268","messageId":"12531516812201@web36o.yandex.ru","threadId":"44520","inReplyTo":"CA+P7+xqMUPLC-aKW-fiS629_Owat8sCa5vp_bOwQTO8LP4hCzw@mail.gmail.com","subject":"Re: Feature request: Improve diff algorithm","fromName":"KES","fromEmail":"kes-kes@yandex.ru","sentAt":"2018-01-24T16:43:21Z","receivedAt":"2018-01-24T16:43:31Z","isPatch":false,"sender":{"key":"kes-kes@yandex.ru","avatar":null},"body":"Here is another place where diff can be improved:\n@@ -141,8 +140,9 @@ My_runops(pTHX)\n \t\t// Do not trace variables in DB:: module\n \t\tif( SvOK( inDB ) ) continue;\n \n-\t\tsv_inc_nomg( inDB );\n \n+\t\t// save_item( inDB );\n+\t\tsv_inc_nomg( inDB );\n \t\tdSP; SINFO; SAVETMPS;\n \n \t\t// printf( \"SWITCH\\n\" );\n\n\nThis would be better it the patch looks like:\n( this patch is manually created just to light the idea. It may contain errors)\n@@ -140,6 +140,7 @@ My_runops(pTHX)\n         // Do not trace variables in DB:: module\n         if( SvOK( inDB ) ) continue;\n\n+ \n+        // save_item( inDB );\n         sv_inc_nomg( inDB );\n- \n         dSP; SINFO; SAVETMPS;\n\nAs we can see, here the `sv_inc_nomg( inDB );` line is unchanged and `// save_item( inDB );` is added.\nHere we just add/remove empty lines and patch looks more better.\n\nI think (and this is my assumption), the the diff algorithm should take into account the string length.\nThis is more better to add/remove more short lines\n\n21.11.2016, 20:55, \"Jacob Keller\" <jacob.keller@gmail.com>:\n> On Mon, Nov 21, 2016 at 10:17 AM, Stefan Beller <sbeller@google.com> wrote:\n>>  On Mon, Nov 21, 2016 at 8:56 AM, Jacob Keller <jacob.keller@gmail.com> wrote:\n>>>  On Mon, Nov 21, 2016 at 12:11 AM, KES <kes-kes@yandex.ru> wrote:\n>>>>  Hi.\n>>>\n>>>  Hi,\n>>>\n>>>>  I have some question about how diff works then give proposal:\n>>>>\n>>>>  it will be very useful for each \"symbol\" store additional meta info as source line length. So in this case when git counter two equal sequence of commands it will do further comparison: Adds 23 chars deletes none VS adds 75 chars deletes 46\n>>>>\n>>>>  Actually I got this:\n>>>>\n>>>>  @@ -129,8 +132,9 @@ sub _preprocess_message {\n>>>>   sub _process_message {\n>>>>       my ($self, $message) = @_;\n>>>>\n>>>>  - my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n>>>>  + my $time = [ gettimeofday ];\n>>>>\n>>>>  + my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n>>>>       return $self->send_error(ERROR_REQUEST_INVALID)\n>>>>           unless defined($method);\n>>>>\n>>>>  Instead of expected:\n>>>>  @@ -129,6 +132,8 @@ sub _preprocess_message {\n>>>>   sub _process_message {\n>>>>       my ($self, $message) = @_;\n>>>>\n>>>>  + my $time = [ gettimeofday ];\n>>>>  +\n>>>>       my $method = ref($message) eq 'HASH' ? $message->{method} : undef;\n>>>>  -\n>>>>       return $self->send_error(ERROR_REQUEST_INVALID)\n>>>\n>>>  Have you tried the various options for git to search for smaller\n>>>  diffs? Or using the other diff algorithms such as histogram instead of\n>>>  patience?\n>>\n>>  The newest version of Git comes with a flag to move around the diff\n>>  better, based on the work at https://github.com/mhagger/diff-slider-tools\n>\n> Unfortunately in this case, I'm not convinced that it will improve the\n> diff. It's worth a try as well though.\n>\n> Thanks,\n> Jake\n"},{"id":"337275","messageId":"CA+P7+xrVavoJkPmR17sbUS4zTH4ZioHJLgaKBvXg45UN1popxg@mail.gmail.com","threadId":"44520","inReplyTo":"12531516812201@web36o.yandex.ru","subject":"Re: Feature request: Improve diff algorithm","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2018-01-24T18:06:53Z","receivedAt":"2018-01-24T18:07:19Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Wed, Jan 24, 2018 at 8:43 AM, KES <kes-kes@yandex.ru> wrote:\n> Here is another place where diff can be improved:\n> @@ -141,8 +140,9 @@ My_runops(pTHX)\n>                 // Do not trace variables in DB:: module\n>                 if( SvOK( inDB ) ) continue;\n>\n> -               sv_inc_nomg( inDB );\n>\n> +               // save_item( inDB );\n> +               sv_inc_nomg( inDB );\n>                 dSP; SINFO; SAVETMPS;\n>\n>                 // printf( \"SWITCH\\n\" );\n>\n>\n> This would be better it the patch looks like:\n> ( this patch is manually created just to light the idea. It may contain errors)\n> @@ -140,6 +140,7 @@ My_runops(pTHX)\n>          // Do not trace variables in DB:: module\n>          if( SvOK( inDB ) ) continue;\n>\n> +\n> +        // save_item( inDB );\n>          sv_inc_nomg( inDB );\n> -\n>          dSP; SINFO; SAVETMPS;\n>\n> As we can see, here the `sv_inc_nomg( inDB );` line is unchanged and `// save_item( inDB );` is added.\n> Here we just add/remove empty lines and patch looks more better.\n>\n> I think (and this is my assumption), the the diff algorithm should take into account the string length.\n> This is more better to add/remove more short lines\n>\n\nHi,\n\nCan you check if this is already handled by --indent-heuristic option\nof diff? I think it might help this one already.\n\nThanks,\nJake\n"},{"id":"337399","messageId":"446801516908691@web22j.yandex.ru","threadId":"44520","inReplyTo":"12531516812201@web36o.yandex.ru","subject":"Re: Feature request: Improve diff algorithm","fromName":"KES","fromEmail":"kes-kes@yandex.ru","sentAt":"2018-01-25T19:31:31Z","receivedAt":"2018-01-25T19:31:39Z","isPatch":false,"sender":{"key":"kes-kes@yandex.ru","avatar":null},"body":"One yet more:\n\n@@ -141,5 +86,9 @@\n \t// }\n \n \n-\tOP* o;\n+\tSV *tvs =  newSVpvs( \"ScalarHistory\" );\n+\tSV *tva =  newSVpvs( \"ArrayHistory\"  );\n+\tSV *tvh =  newSVpvs( \"HashHistory\"   );\n+\n+\tOP *o;\n \twhile( PL_op ) {\n\n"},{"id":"337401","messageId":"20180125201250.30171-1-szeder.dev@gmail.com","threadId":"44520","inReplyTo":"446801516908691@web22j.yandex.ru","subject":"Re: Feature request: Improve diff algorithm","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-01-25T20:12:50Z","receivedAt":"2018-01-25T20:13:10Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"> One yet more:\n> \n> @@ -141,5 +86,9 @@\n>  \t// }\n>  \n>  \n> -\tOP* o;\n> +\tSV *tvs =  newSVpvs( \"ScalarHistory\" );\n> +\tSV *tva =  newSVpvs( \"ArrayHistory\"  );\n> +\tSV *tvh =  newSVpvs( \"HashHistory\"   );\n> +\n> +\tOP *o;\n>  \twhile( PL_op ) {\n\nWhat version of Git are you using?\n\nThe current version gives me this:\n\ndiff --git a/f b/f\nindex 30a292bbd..fa1e98292 100644\n--- a/f\n+++ b/f\n@@ -1,5 +1,9 @@\n \t// }\n \n \n+\tSV *tvs =  newSVpvs( \"ScalarHistory\" );\n+\tSV *tva =  newSVpvs( \"ArrayHistory\"  );\n+\tSV *tvh =  newSVpvs( \"HashHistory\"   );\n+\n \tOP* o;\n \twhile( PL_op ) {\n"},{"id":"337404","messageId":"xmqqfu6tad9v.fsf@gitster.mtv.corp.google.com","threadId":"44520","inReplyTo":"446801516908691@web22j.yandex.ru","subject":"Re: Feature request: Improve diff algorithm","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-01-25T20:34:20Z","receivedAt":"2018-01-25T20:34:35Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"KES <kes-kes@yandex.ru> writes:\n\n> One yet more:\n>\n> @@ -141,5 +86,9 @@\n>  \t// }\n>  \n>  \n> -\tOP* o;\n> +\tSV *tvs =  newSVpvs( \"ScalarHistory\" );\n> +\tSV *tva =  newSVpvs( \"ArrayHistory\"  );\n> +\tSV *tvh =  newSVpvs( \"HashHistory\"   );\n> +\n> +\tOP *o;\n>  \twhile( PL_op ) {\n\nHuh?\n\nIf the asterisk between type OP and var o did not change, then\ninserting the three new lines before o's definition may make sense,\nbut otherwise...\n\n"},{"id":"337407","messageId":"CAM0VKj=ZMbYPBcXCU9T4iKCLhQ1O8wK8737KQTfiAEF9GWZs3Q@mail.gmail.com","threadId":"44520","inReplyTo":"20180125201250.30171-1-szeder.dev@gmail.com","subject":"Re: Feature request: Improve diff algorithm","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-01-25T20:49:40Z","receivedAt":"2018-01-25T20:49:46Z","isPatch":false,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Thu, Jan 25, 2018 at 9:12 PM, SZEDER Gábor <szeder.dev@gmail.com> wrote:\n>> One yet more:\n>>\n>> @@ -141,5 +86,9 @@\n>>       // }\n>>\n>>\n>> -     OP* o;\n\nOops, when trying to reproduce I overlooked that here the * is stuck\nafter OP ...\n\n>> +     SV *tvs =  newSVpvs( \"ScalarHistory\" );\n>> +     SV *tva =  newSVpvs( \"ArrayHistory\"  );\n>> +     SV *tvh =  newSVpvs( \"HashHistory\"   );\n>> +\n>> +     OP *o;\n\n... but here it's stuck to o.\n\nWith that adjusted I do get the same diff as you, and I think that's the\nright output in this case.\n"},{"id":"337500","messageId":"CAGZ79kZX3NOb4ttXvjV0=vrLrMTj7z7N=+=DUtd0+3gYWJ6wng@mail.gmail.com","threadId":"44520","inReplyTo":"12531516812201@web36o.yandex.ru","subject":"Re: Feature request: Improve diff algorithm","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-01-26T18:29:52Z","receivedAt":"2018-01-26T18:29:59Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Jan 24, 2018 at 8:43 AM, KES <kes-kes@yandex.ru> wrote:\n> Here is another place where diff can be improved:\n> @@ -141,8 +140,9 @@ My_runops(pTHX)\n>                 // Do not trace variables in DB:: module\n>                 if( SvOK( inDB ) ) continue;\n>\n> -               sv_inc_nomg( inDB );\n>\n> +               // save_item( inDB );\n> +               sv_inc_nomg( inDB );\n>                 dSP; SINFO; SAVETMPS;\n>\n>                 // printf( \"SWITCH\\n\" );\n>\n>\n\n(Manually reconstructing), the before:\n\n                 // Do not trace variables in DB:: module\n                 if( SvOK( inDB ) ) continue;\n\n                 sv_inc_nomg( inDB );\n\n                 dSP; SINFO; SAVETMPS;\n\n                 // printf( \"SWITCH\\n\" );\n\nand after:\n\n                 // Do not trace variables in DB:: module\n                 if( SvOK( inDB ) ) continue;\n\n\n                  // save_item( inDB );\n                  sv_inc_nomg( inDB );\n                 dSP; SINFO; SAVETMPS;\n\n                 // printf( \"SWITCH\\n\" );\n\n\n\n> This would be better it the patch looks like:\n> ( this patch is manually created just to light the idea. It may contain errors)\n> @@ -140,6 +140,7 @@ My_runops(pTHX)\n>          // Do not trace variables in DB:: module\n>          if( SvOK( inDB ) ) continue;\n>\n> +\n> +        // save_item( inDB );\n>          sv_inc_nomg( inDB );\n> -\n>          dSP; SINFO; SAVETMPS;\n\nBefore:\n\n          // Do not trace variables in DB:: module\n          if( SvOK( inDB ) ) continue;\n\n          sv_inc_nomg( inDB );\n\n          dSP; SINFO; SAVETMPS;\n\nafter:\n\n          if( SvOK( inDB ) ) continue;\n\n\n          // save_item( inDB );\n          sv_inc_nomg( inDB );\n          dSP; SINFO; SAVETMPS;\n\nSeems like the diff is the same.\nI agree that we'd rather want to remove/add empty lines\ninstead of moving full lines. Maybe we can add a penalty for that\nin the diff code. Currently each line costs the same, as diff algorithm\noptimizes for number of lines to be minimal, which both these diffs\nsatisfy.\n\n\n>\n> As we can see, here the `sv_inc_nomg( inDB );` line is unchanged and `// save_item( inDB );` is added.\n> Here we just add/remove empty lines and patch looks more better.\n>\n> I think (and this is my assumption), the the diff algorithm should take into account the string length.\n> This is more better to add/remove more short lines\n\nYup. Thanks for giving an example.\n"},{"id":"337572","messageId":"1408921517058505@web15o.yandex.ru","threadId":"44520","inReplyTo":"446801516908691@web22j.yandex.ru","subject":"Re: Feature request: Improve diff algorithm","fromName":"KES","fromEmail":"kes-kes@yandex.ru","sentAt":"2018-01-27T13:08:25Z","receivedAt":"2018-01-27T13:08:41Z","isPatch":false,"sender":{"key":"kes-kes@yandex.ru","avatar":null},"body":"One yet more:\n\n@@ -43,22 +44,25 @@ sub tariff_title {\n 1;\n \n __DATA__\n-@@ control/tariff.css\n-* {\n-    margin: 0;\n-    padding: 0;\n-    border: 0;\n-    -webkit-box-sizing: border-box;\n-    box-sizing: border-box; }\n-html {\n-    background-color: #121212;\n-    color: white;\n-    font-family: 'Roboto', 'Arial',  sans-serif;\n-    font-size: 16px; }\n-a {\n-    cursor: pointer; }\n \n \n+@@ control/tariff_about_old.html.ep\n+<div class=\"option__about\">\n+  <div class=\"option__info\">\n+    <div class=\"option__icon\"><img src=\"<%= $icon %>\"></div>\n+    <h3 class=\"option__name\"><%= $title %></h3>\n+  </div>\n+  <div class=\"option__duration\">\n+    <p><%== $option1 %><%= stash->{ comment1 }? \"<span> (\" .stash->{ comment1 }.\")</span>\": '' %></\n+    <div class=\"switch option__switch\">\n+      <input class=\"switch__toggle\" type=\"checkbox\" checked id=\"<%= $id %>\">\n+      <label for=\"<%= $id %>\"></label>\n+    </div>\n+    <p><%== $option2 %><%= stash->{ comment2 }? \"<span> (\" .stash->{ comment2 }.\")</span>\": '' %></\n+  </div>\n+</div>\n+\n+@@ control/tariff.css\n /*  BASE BUTTON FOR TARIFF CARD  */\n .button {\n   display: -webkit-box;\n\nBut it would be better if `@@ control/tariff.css` were untouched:\n\n@@ -43,22 +44,25 @@ sub tariff_title {\n 1;\n \n __DATA__\n+\n+\n+@@ control/tariff_about_old.html.ep\n+<div class=\"option__about\">\n+  <div class=\"option__info\">\n+    <div class=\"option__icon\"><img src=\"<%= $icon %>\"></div>\n+    <h3 class=\"option__name\"><%= $title %></h3>\n+  </div>\n+  <div class=\"option__duration\">\n+    <p><%== $option1 %><%= stash->{ comment1 }? \"<span> (\" .stash->{ comment1 }.\")</span>\": '' %></\n+    <div class=\"switch option__switch\">\n+      <input class=\"switch__toggle\" type=\"checkbox\" checked id=\"<%= $id %>\">\n+      <label for=\"<%= $id %>\"></label>\n+    </div>\n+    <p><%== $option2 %><%= stash->{ comment2 }? \"<span> (\" .stash->{ comment2 }.\")</span>\": '' %></\n+  </div>\n+</div>\n+\n @@ control/tariff.css\n-* {\n-    margin: 0;\n-    padding: 0;\n-    border: 0;\n-    -webkit-box-sizing: border-box;\n-    box-sizing: border-box; }\n-html {\n-    background-color: #121212;\n-    color: white;\n-    font-family: 'Roboto', 'Arial',  sans-serif;\n-    font-size: 16px; }\n-a {\n-    cursor: pointer; }\n-\n-\n /*  BASE BUTTON FOR TARIFF CARD  */\n .button {\n   display: -webkit-box;\n\n"},{"id":"337793","messageId":"CAGZ79kZbhHugy4EOjXn4DO_XjpdrAnKhk56j4Ew2XGggGYQVyQ@mail.gmail.com","threadId":"44520","inReplyTo":"1408921517058505@web15o.yandex.ru","subject":"Re: Feature request: Improve diff algorithm","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2018-01-30T18:26:41Z","receivedAt":"2018-01-30T18:26:48Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Sat, Jan 27, 2018 at 5:08 AM, KES <kes-kes@yandex.ru> wrote:\n> One yet more:\n>\n> @@ -43,22 +44,25 @@ sub tariff_title {\n>  1;\n>\n>  __DATA__\n> -@@ control/tariff.css\n> -* {\n> -    margin: 0;\n> -    padding: 0;\n> -    border: 0;\n> -    -webkit-box-sizing: border-box;\n> -    box-sizing: border-box; }\n> -html {\n> -    background-color: #121212;\n> -    color: white;\n> -    font-family: 'Roboto', 'Arial',  sans-serif;\n> -    font-size: 16px; }\n> -a {\n> -    cursor: pointer; }\n>\n>\n> +@@ control/tariff_about_old.html.ep\n> +<div class=\"option__about\">\n> +  <div class=\"option__info\">\n> +    <div class=\"option__icon\"><img src=\"<%= $icon %>\"></div>\n> +    <h3 class=\"option__name\"><%= $title %></h3>\n> +  </div>\n> +  <div class=\"option__duration\">\n> +    <p><%== $option1 %><%= stash->{ comment1 }? \"<span> (\" .stash->{ comment1 }.\")</span>\": '' %></\n> +    <div class=\"switch option__switch\">\n> +      <input class=\"switch__toggle\" type=\"checkbox\" checked id=\"<%= $id %>\">\n> +      <label for=\"<%= $id %>\"></label>\n> +    </div>\n> +    <p><%== $option2 %><%= stash->{ comment2 }? \"<span> (\" .stash->{ comment2 }.\")</span>\": '' %></\n> +  </div>\n> +</div>\n> +\n> +@@ control/tariff.css\n>  /*  BASE BUTTON FOR TARIFF CARD  */\n>  .button {\n>    display: -webkit-box;\n>\n> But it would be better if `@@ control/tariff.css` were untouched:\n>\n> @@ -43,22 +44,25 @@ sub tariff_title {\n>  1;\n>\n>  __DATA__\n> +\n> +\n> +@@ control/tariff_about_old.html.ep\n> +<div class=\"option__about\">\n> +  <div class=\"option__info\">\n> +    <div class=\"option__icon\"><img src=\"<%= $icon %>\"></div>\n> +    <h3 class=\"option__name\"><%= $title %></h3>\n> +  </div>\n> +  <div class=\"option__duration\">\n> +    <p><%== $option1 %><%= stash->{ comment1 }? \"<span> (\" .stash->{ comment1 }.\")</span>\": '' %></\n> +    <div class=\"switch option__switch\">\n> +      <input class=\"switch__toggle\" type=\"checkbox\" checked id=\"<%= $id %>\">\n> +      <label for=\"<%= $id %>\"></label>\n> +    </div>\n> +    <p><%== $option2 %><%= stash->{ comment2 }? \"<span> (\" .stash->{ comment2 }.\")</span>\": '' %></\n> +  </div>\n> +</div>\n> +\n>  @@ control/tariff.css\n> -* {\n> -    margin: 0;\n> -    padding: 0;\n> -    border: 0;\n> -    -webkit-box-sizing: border-box;\n> -    box-sizing: border-box; }\n> -html {\n> -    background-color: #121212;\n> -    color: white;\n> -    font-family: 'Roboto', 'Arial',  sans-serif;\n> -    font-size: 16px; }\n> -a {\n> -    cursor: pointer; }\n> -\n> -\n>  /*  BASE BUTTON FOR TARIFF CARD  */\n>  .button {\n>    display: -webkit-box;\n>\n\nTry the new option that Jonathan Tan implemented:\n\n  git diff --anchor=\"@@ control/tariff.css\"\n\nto produce the second diff.\n\nI wonder if we want to have a permanent store for these\nlines in given diffs, such that you only have to figure it out once.\n(And eventually the community will have a corpus of data to\nfigure out how to improve the diff for real)\n"}]}