X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=Documentation%2Fdiff-format.txt;h=d6ce035419081e3fbfc2375ac667517f5f52c980;hb=ade75a59fd0738757019456e0a5a39d3d1af85d7;hp=1d92a01a02543e55d0feb3541ee594fbc638136c;hpb=ddafa7e93325d45cd4bd950dd8e89ff3188d0250;p=git.git diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt index 1d92a01a0..d6ce03541 100644 --- a/Documentation/diff-format.txt +++ b/Documentation/diff-format.txt @@ -36,12 +36,13 @@ That is, from the left to the right: (6) sha1 for "src"; 0{40} if creation or unmerged. (7) a space. (8) sha1 for "dst"; 0{40} if creation, unmerged or "look at work tree". - (9) status, followed by optional "score" number. - (10) a tab or a NUL when '-z' option is used. - (11) path for "src" - (12) a tab or a NUL when '-z' option is used; only exists for C or R. - (13) path for "dst"; only exists for C or R. - (14) an LF or a NUL when '-z' option is used, to terminate the record. + (9) a space. + (10) status, followed by optional "score" number. + (11) a tab or a NUL when '-z' option is used. + (12) path for "src" + (13) a tab or a NUL when '-z' option is used; only exists for C or R. + (14) path for "dst"; only exists for C or R. + (15) an LF or a NUL when '-z' option is used, to terminate the record. is shown as all 0's if new is a file on the filesystem and it is out of sync with the cache. Example: @@ -52,7 +53,7 @@ Generating patches with -p -------------------------- When "git-diff-cache", "git-diff-tree", or "git-diff-files" are run -with a '-p' option, they do not produce the output described above +with a '-p' option, they do not produce the output described above; instead they produce a patch file. The patch generation can be customized at two levels. This @@ -98,3 +99,37 @@ temporary file --- it is removed when 'GIT_EXTERNAL_DIFF' exits. For a path that is unmerged, 'GIT_EXTERNAL_DIFF' is called with 1 parameter, . + + +Git specific extention to diff format +------------------------------------- + +What -p option produces is slightly different from the +traditional diff format. + + (1) It is preceeded with a "git diff" header, that looks like + this: + + diff --git a/file1 b/file2 + + 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/ filename. + + When rename/copy is involved, file1 and file2 shows the + name of the source file of the rename/copy and the name of + the file that rename/copy produces, respectively. + + (2) It is followed by extended header lines that are one or + more of: + + old mode + new mode + deleted file mode + new file mode + copy from + copy to + rename from + rename to + similarity index + dissimilarity index