Skip to content

Commit

Permalink
doc: git-diff: apply format changes to diff-generate-patch
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Noël Avila <[email protected]>
  • Loading branch information
jnavila committed Aug 4, 2024
1 parent 236917e commit 6afa2fb
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions Documentation/diff-generate-patch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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>
+
The `mode <mode>,<mode>..<mode>` line appears only if at least one of
the <mode> is different from the rest. Extended headers with
[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:

Expand Down

0 comments on commit 6afa2fb

Please sign in to comment.