{"thread":{"id":"42276","subject":"diff --break-rewrites for just a part of a file","startedAt":"2016-05-10T16:22:34Z","lastAt":"2016-05-10T19:16:59Z","messageCount":2,"participants":["Sascha Silbe","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"286075","messageId":"toea8jx3mt1.fsf@mimosa.sascha.silbe.org","threadId":"42276","inReplyTo":null,"subject":"diff --break-rewrites for just a part of a file","fromName":"Sascha Silbe","fromEmail":"sascha-ml-reply-to-2016-2@silbe.org","sentAt":"2016-05-10T16:22:34Z","receivedAt":"2016-05-10T16:22:34Z","isPatch":false,"sender":{"key":"sascha-ml-reply-to-2016-2@silbe.org","avatar":null},"body":"Hello,\n\nthe other day I was reviewing a patch that replaced a large chunk in a\nMakefile with completely different logic. No matter what diff algorithm\nand options I threw at it, the diff would always synchronise at the\nempty lines between individual targets and thus show the rewrite of a\nlarger section as complete replacements of many smaller, but directly\nadjacent sections (only separated by a blank line).\n\n--break-rewrites would be nicely suited for this case, but once I dialed\ndown the parameters enough for the option to apply at all, it showed the\nentire file as being replaced rather than just the section in between\nthat actually changed. Is there a way to have --break-rewrites leave out\nthe unchanged lines at beginning and end of the file?\n\nA combination of --break-rewrites and --inter-hunk-context that merges\nchanges with less than the given number of unchanged lines between them\ninto a single delete/insert change would be even better. But just\nignoring the unchanged header and footer of a file for --break-rewrites\nwould already go a long way.\n\nSascha\n"},{"id":"286098","messageId":"xmqq1t59pvtg.fsf@gitster.mtv.corp.google.com","threadId":"42276","inReplyTo":"toea8jx3mt1.fsf@mimosa.sascha.silbe.org","subject":"Re: diff --break-rewrites for just a part of a file","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-10T19:16:59Z","receivedAt":"2016-05-10T19:16:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sascha Silbe <sascha-ml-reply-to-2016-2@silbe.org> writes:\n\n> A combination of --break-rewrites and --inter-hunk-context that merges\n> changes with less than the given number of unchanged lines between them\n> into a single delete/insert change would be even better. But just\n> ignoring the unchanged header and footer of a file for --break-rewrites\n> would already go a long way.\n\nThat's interesting.  Break-rewrites as originally designed and\nimplemented is only about \"When the entire file been rewritten\ncompletely, it is easier to read when the diff did not pay any\nattention to those accidentally common lines\".\n\nWe recently had a discussion on tweaking the logic used to merge and\nminimize hunks; the topic was about where to start the hunk boundary\nfor maximum readability when the beginning and end of a hunk can be\nshifted around, but this smells like a similar issue.\n"}]}