@@ -65,62 +65,17 @@ Generating patches with -p
6565
6666When "git-diff-index", "git-diff-tree", or "git-diff-files" are run
6767with a '-p' option, they do not produce the output described above;
68- instead they produce a patch file.
68+ instead they produce a patch file. You can customize the creation
69+ of such patches via the GIT_EXTERNAL_DIFF and the GIT_DIFF_OPTS
70+ environment variables.
6971
70- The patch generation can be customized at two levels.
71-
72- 1. When the environment variable 'GIT_EXTERNAL_DIFF' is not set,
73- these commands internally invoke "diff" like this:
74-
75- diff -L a/<path> -L b/<path> -pu <old> <new>
76- +
77- For added files, `/dev/null` is used for <old>. For removed
78- files, `/dev/null` is used for <new>
79- +
80- The "diff" formatting options can be customized via the
81- environment variable 'GIT_DIFF_OPTS'. For example, if you
82- prefer context diff:
83-
84- GIT_DIFF_OPTS=-c git-diff-index -p HEAD
85-
86-
87- 2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
88- program named by it is called, instead of the diff invocation
89- described above.
90- +
91- For a path that is added, removed, or modified,
92- 'GIT_EXTERNAL_DIFF' is called with 7 parameters:
93-
94- path old-file old-hex old-mode new-file new-hex new-mode
95- +
96- where:
97-
98- <old|new>-file:: are files GIT_EXTERNAL_DIFF can use to read the
99- contents of <old|new>,
100- <old|new>-hex:: are the 40-hexdigit SHA1 hashes,
101- <old|new>-mode:: are the octal representation of the file modes.
102-
103- +
104- The file parameters can point at the user's working file
105- (e.g. `new-file` in "git-diff-files"), `/dev/null` (e.g. `old-file`
106- when a new file is added), or a temporary file (e.g. `old-file` in the
107- index). 'GIT_EXTERNAL_DIFF' should not worry about unlinking the
108- temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits.
109-
110- For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1
111- parameter, <path>.
112-
113-
114- git specific extension to diff format
115- -------------------------------------
116-
117- What -p option produces is slightly different from the
118- traditional diff format.
72+ What the -p option produces is slightly different from the traditional
73+ diff format.
11974
120751. It is preceded with a "git diff" header, that looks like
12176 this:
12277
123- diff --git a/file1 b/file2
78+ diff --git a/file1 b/file2
12479+
12580The `a/` and `b/` filenames are the same unless rename/copy is
12681involved. Especially, even for a creation or a deletion,
0 commit comments