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

diff --break-rewrites for just a part of a file

From
SSSascha Silbe <sascha-ml-reply-to-2016-2@silbe.org>
Date
May 10, 2016, 16:22 UTC
Message-ID
<toea8jx3mt1.fsf@mimosa.sascha.silbe.org>
Hello,

the other day I was reviewing a patch that replaced a large chunk in a Makefile with completely different logic. No matter what diff algorithm and options I threw at it, the diff would always synchronise at the empty lines between individual targets and thus show the rewrite of a larger section as complete replacements of many smaller, but directly adjacent sections (only separated by a blank line).

--break-rewrites would be nicely suited for this case, but once I dialed down the parameters enough for the option to apply at all, it showed the entire file as being replaced rather than just the section in between that actually changed. Is there a way to have --break-rewrites leave out the unchanged lines at beginning and end of the file?

A combination of --break-rewrites and --inter-hunk-context that merges changes with less than the given number of unchanged lines between them into a single delete/insert change would be even better. But just ignoring the unchanged header and footer of a file for --break-rewrites would already go a long way.

Sascha
Next: Junio C Hamano
Message 1 of 2 in “diff --break-rewrites for just a part of a file”
  1. Sascha SilbeMay 10, 2016
  2. Junio C HamanoMay 10, 2016

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.