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

Re: [PATCH, RFC] diff: add option to show context between close chunks

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Oct 21, 2008, 18:16 UTC
Message-ID
<alpine.LNX.1.00.0810211403120.19665@iabervon.org>
In-Reply-To
<48FD781C.2000103@viscovery.net>
On Tue, 21 Oct 2008, Johannes Sixt wrote:
Show 15 quoted lines
> Junio C Hamano schrieb:
> > René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
> > 
> >> I think it makes sense to make 1, or even 3, the default for this
> >> option for all commands that create patches intended for human
> >> consumption.  The patch keeps the default at 0, though.
> > 
> > I think defaulting to 1 would make sense, or alternatively, just
> > hardcoding that behaviour without any new option.  That would give you
> > more information with the same number of patch lines, iow, upside without
> > any downside.
> 
> Are you sure about the "without any downside" part? The extra context line
> inhibits that the patch applies cleanly to a version of the file that has
> that very line modified (including a different number of lines).

We could start allowing "fuzz" by default in the case of a patch with more context than we'd expect to see. That is, git-apply would ignore context lines more than 3 lines away from any changed lines, sharing the assumption of our patch-generation side that lines that far away don't matter in general. (Now, if people were in the habit of including as context additional lines in fragile locations, this wouldn't be a good assumption, but I doubt anybody would be able to identify such lines to include them).

	-Daniel
*This .sig left intentionally blank*
Previous: René Scharfe
Message 11 of 11 in “diff: add option to show context between close chunks”
  1. diff: add option to show context between close chunksRené Scharfe, Oct 19, 2008
  2. Johannes SixtOct 20, 2008
  3. René ScharfeOct 20, 2008
  4. Johannes SixtOct 21, 2008
  5. René ScharfeOct 21, 2008
  6. Junio C HamanoOct 20, 2008
  7. Johannes SixtOct 21, 2008
  8. Junio C HamanoOct 21, 2008
  9. Jeff KingOct 21, 2008
  10. René ScharfeOct 21, 2008
  11. Daniel BarkalowOct 21, 2008

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.