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

Re: [PATCH] Improve the "diff --git" format documentation

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 14, 2010, 16:16 UTC
Message-ID
<20101014161636.GB16500@burratino>
In-Reply-To
<201010141439.43168.agruen@suse.de>
Andreas Gruenbacher wrote:
> I still believe that the documentation should make it very clear how it
> handles created and deleted files;
Yes - thanks for doing this.
Show 8 quoted lines
> --- a/Documentation/diff-generate-patch.txt
> +++ b/Documentation/diff-generate-patch.txt
> @@ -53,12 +53,22 @@ The index line includes the SHA-1 checksum before and after the change.
>  The <mode> is included if the file mode does not change; otherwise,
>  separate lines indicate the old and the new mode.
>  
> -3.  TAB, LF, double quote and backslash characters in pathnames
> +3.  It is followed by a 'unified' diff which starts with a two-line
So afterwards the section would say:
	What the -p option produces is slightly different from the traditional
	diff format.
	1.   It is preceded with a "git diff" header, that looks like
	     this:
	       diff --git a/file1 b/file2
	[...]
	2.   It is followed by one or more extended header lines:
	       old mode <mode>
	       new mode <mode>
	[...]
	3.   It is followed by a 'unified' diff which starts with a two-line
	[...]

At some point, the reader starts to wonder what "it" is. :) (2) already has this problem, since the extended header lines actually precede the traditional diff rather than following it.

How about:
	What the -p option produces is slightly different[...]
	1. It is preceded with a "git diff" header[...]
	2. Next comes one or more extended header lines[...]
	3. The from-file/to-file header that follows uses filenames
	of the form a/file1 and b/file2 (where "a/" and "b/" can be
	replaced with some other string or removed depending on
	options used):
		--- a/file1
		+++ b/file2
	This header is omitted if[...]
	4. TAB, LF, double quote, and [...]
Jonathan
Previous: Andreas GruenbacherNext: Junio C Hamano
Message 9 of 10 in “Improve the "diff --git" format documentation”
  1. Improve the "diff --git" format documentationAndreas Gruenbacher, Oct 6, 2010
  2. Junio C HamanoOct 6, 2010
  3. Andreas GruenbacherOct 6, 2010
  4. Andreas GruenbacherOct 11, 2010
  5. Junio C HamanoOct 14, 2010
  6. Junio C HamanoOct 14, 2010
  7. Andreas GruenbacherOct 14, 2010
  8. Andreas GruenbacherOct 14, 2010
  9. Jonathan NiederOct 14, 2010
  10. Junio C HamanoOct 17, 2010

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.