@matheusbsbs / matheus-bagliano / commits / 34801cab72
Fork 0

Documentation: diff -c/--cc

Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Jan 28, 2006 at 02:19 UTC 34801cab72e8262d2585f72f15b62a397f0c6c1a
3 files changed +73 -3
Documentation/diff-format.txt
+49
@@ -146,3 +146,52 @@ the file that rename/copy produces, respectively.
146
147 3. TAB, LF, and backslash characters in pathnames are
148 represented as `\t`, `\n`, and `\\`, respectively.
149 +
150 +
151 +combined diff format
152 +--------------------
153 +
154 +git-diff-tree and git-diff-files can take '-c' or '--cc' option
155 +to produce 'combined diff', which looks like this:
156 +
157 +------------
158 +diff --combined describe.c
159 +@@@ +98,7 @@@
160 + return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
161 + }
162 +
163 +- static void describe(char *arg)
164 + -static void describe(struct commit *cmit, int last_one)
165 +++static void describe(char *arg, int last_one)
166 + {
167 + + unsigned char sha1[20];
168 + + struct commit *cmit;
169 +------------
170 +
171 +Unlike the traditional 'unified' diff format, which shows two
172 +files A and B with a single column that has `-` (minus --
173 +appears in A but removed in B), `+` (plus -- missing in A but
174 +added to B), or ` ` (space -- unchanged) prefix, this format
175 +compares two or more files file1, file2,... with one file X, and
176 +shows how X differs from each of fileN. One column for each of
177 +fileN is prepended to the output line to note how X's line is
178 +different from it.
179 +
180 +A `-` character in the column N means that the line appears in
181 +fileN but it does not appear in the last file. A `+` character
182 +in the column N means that the line appears in the last file,
183 +and fileN does not have that line.
184 +
185 +In the above example output, the function signature was changed
186 +from both files (hence two `-` removals from both file1 and
187 +file2, plus `++` to mean one line that was added does not appear
188 +in either file1 nor file2). Also two other lines are the same
189 +from file1 but do not appear in file2 (hence prefixed with ` +`).
190 +
191 +When shown by `git diff-tree -c`, it compares the parents of a
192 +merge commit with the merge result (i.e. file1..fileN are the
193 +parents). When shown by `git diff-files -c`, it compares the
194 +two unresolved merge parents with the working tree file
195 +(i.e. file1 is stage 2 aka "our version", file2 is stage 3 aka
196 +"their version").
197 +
Documentation/git-diff-files.txt
+7 -1
@@ -8,7 +8,7 @@ git-diff-files - Compares files in the working tree and the index
8
9 SYNOPSIS
10 --------
11 -'git-diff-files' [-q] [<common diff options>] [<path>...]
11 +'git-diff-files' [-q] [-0|-1|-2|-3|-c|--cc] [<common diff options>] [<path>...]
12
13 DESCRIPTION
14 -----------
@@ -30,6 +30,12 @@ The default is to diff against our branch (-2) and the
30 cleanly resolved paths. The option -0 can be given to
31 omit diff output for unmerged entries and just show "Unmerged".
32
33 +-c,--cc::
34 + This compares stage 2 (our branch), stage 3 (their
35 + branch) and the working tree file and outputs a combined
36 + diff, similar to the way 'diff-tree' shows a merge
37 + commit with these flags.
38 +
39 -q::
40 Remain silent even on nonexisting files
41
Documentation/git-diff-tree.txt
+17 -2
@@ -9,8 +9,9 @@ git-diff-tree - Compares the content and mode of blobs found via two tree object
9 SYNOPSIS
10 --------
11 [verse]
12 -'git-diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty] [-t] [-r]
13 - [--root] [<common diff options>] <tree-ish> [<tree-ish>] [<path>...]
12 +'git-diff-tree' [--stdin] [-m] [-s] [-v] [--no-commit-id] [--pretty]
13 + [-t] [-r] [-c | --cc] [--root] [<common diff options>]
14 + <tree-ish> [<tree-ish>] [<path>...]
15
16 DESCRIPTION
17 -----------
@@ -80,6 +81,20 @@ separated with a single space are given.
81 git-diff-tree outputs a line with the commit ID when
82 applicable. This flag suppressed the commit ID output.
83
84 +-c,--cc::
85 + These flags change the way a merge commit is displayed
86 + (which means it is useful only when the command is given
87 + one <tree-ish>, or '--stdin'). It shows the differences
88 + from each of the parents to the merge result
89 + simultaneously, instead of showing pairwise diff between
90 + a parent and the result one at a time, which '-m' option
91 + output does. '--cc' further compresses the output by
92 + omiting hunks that show differences from only one
93 + parent, or show the same change from all but one parent
94 + for an Octopus merge. When this optimization makes all
95 + hunks disappear, the commit itself and the commit log
96 + message is not shown, unless '-m' is specified.
97 +
98
99 Limiting Output
100 ---------------