doc: git-diff: apply format changes to diff-generate-patch

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jean-Noël Avila 2024-11-18 22:05:52 +00:00 committed by Junio C Hamano
parent 6ace09b2f9
commit 0b080a70ab
1 changed files with 23 additions and 21 deletions

View File

@ -14,7 +14,7 @@ You can customize the creation of patch text via the
`GIT_EXTERNAL_DIFF` and the `GIT_DIFF_OPTS` environment variables
(see linkgit:git[1]), and the `diff` attribute (see linkgit:gitattributes[5]).

What the -p option produces is slightly different from the traditional
What the `-p` option produces is slightly different from the traditional
diff format:

1. It is preceded by a "git diff" header that looks like this:
@ -30,20 +30,21 @@ name of the source file of the rename/copy and the name of
the file that the rename/copy produces, respectively.

2. It is followed by one or more extended header lines:

old mode <mode>
new mode <mode>
deleted file mode <mode>
new file mode <mode>
copy from <path>
copy to <path>
rename from <path>
rename to <path>
similarity index <number>
dissimilarity index <number>
index <hash>..<hash> <mode>
+
File modes are printed as 6-digit octal numbers including the file type
[synopsis]
old mode <mode>
new mode <mode>
deleted file mode <mode>
new file mode <mode>
copy from <path>
copy to <path>
rename from <path>
rename to <path>
similarity index <number>
dissimilarity index <number>
index <hash>..<hash> <mode>
+
File modes _<mode>_ 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.
@ -56,7 +57,7 @@ files, while 100% dissimilarity means that no line from the old
file made it into the new one.
+
The index line includes the blob object names before and after the change.
The <mode> is included if the file mode does not change; otherwise,
The _<mode>_ is included if the file mode does not change; otherwise,
separate lines indicate the old and the new mode.

3. Pathnames with "unusual" characters are quoted as explained for
@ -134,17 +135,18 @@ or like this (when the `--cc` option is used):

2. It is followed by one or more extended header lines
(this example shows a merge with two parents):

index <hash>,<hash>..<hash>
mode <mode>,<mode>..<mode>
new file mode <mode>
deleted file mode <mode>,<mode>
+
[synopsis]
index <hash>,<hash>..<hash>
mode <mode>,<mode>`..`<mode>
new file mode <mode>
deleted file mode <mode>,<mode>
+
The `mode <mode>,<mode>..<mode>` line appears only if at least one of
the <mode> is different from the rest. Extended headers with
information about detected content movement (renames and
copying detection) are designed to work with the diff of two
<tree-ish> and are not used by combined diff format.
_<tree-ish>_ and are not used by combined diff format.

3. It is followed by a two-line from-file/to-file header: