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