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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 14, 2010, 01:55 UTC
Message-ID
<7v8w21fsgr.fsf@alter.siamese.dyndns.org>
In-Reply-To
<201010070103.17689.agruen@suse.de>
Andreas Gruenbacher <agruen@suse.de> writes:
Show 5 quoted lines
>  The `a/` and `b/` filenames are the same unless rename/copy is
>  involved.  Especially, even for a creation or a deletion,
> -`/dev/null` is _not_ used in place of `a/` or `b/` filenames.
> +`/dev/null` is _not_ used in place of the `a/` or `b/` filenames
> +for nonexisting files (unlike in the unified diff headers).

The description in the parentheses is wrong, unless you qualify whose "unified diff headers" you are talking about. For example:

 http://www.opengroup.org/onlinepubs/9699919799/utilities/diff.html#tag_20_34_10_07

does not mention anything about file creation/deletion events. Perhaps you are referring to cvs or svn output, but I think we can safely drop the parenthesized part without losing clarity.

Show 34 quoted lines
> @@ -37,18 +37,42 @@ the file that rename/copy produces, respectively.
>         similarity index <number>
>         dissimilarity index <number>
>         index <hash>..<hash> <mode>
> -
> -3.  TAB, LF, double quote and backslash characters in pathnames
> -    are represented as `\t`, `\n`, `\"` and `\\`, respectively.
> -    If there is need for such substitution then the whole
> -    pathname is put in double quotes.
> -
> ++
> +File modes are printed as 6-digit octal numbers including the file type
> +and file permission bits.
> ++
> +Path names in extended headers do not include the `a/` and `b/` prefixes.
> ++
>  The similarity index is the percentage of unchanged lines, and
>  the dissimilarity index is the percentage of changed lines.  It
>  is a rounded down integer, followed by a percent sign.  The
>  similarity index value of 100% is thus reserved for two equal
>  files, while 100% dissimilarity means that no line from the old
>  file made it into the new one.
> ++
> +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
> +    are represented as `\t`, `\n`, `\"` and `\\`, respectively.
> +    If there is need for such substitution then the whole
> +    pathname is put in double quotes.
> ++
> +Space characters in pathnames are _not_ quoted, neither in the "git
> +diff" header nor in extended header lines.

I am not sure if there is a particular need to spend an extra paragraph to special case the SP [*1*]. On the other hand, we quote bytes with high-bit set in \octal [*2*], unless core.quotepath is set to false, too, which should probably be described here.

[References]

*1* 28fba29 (Do not quote SP., 2005-10-17) *2* http://marc.info/?l=git&m=112927316408690&w=2

Previous: Junio C HamanoNext: Andreas Gruenbacher
Message 6 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.