Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 921 lines (841 sloc) 23.219 kB
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
1 #include "cache.h"
2 #include "commit.h"
8e44025 Use blob_, commit_, tag_, and tree_type throughout.
Peter Eriksen authored
3 #include "blob.h"
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
4 #include "diff.h"
5 #include "diffcore.h"
6 #include "quote.h"
d9ea73e combine-diff: refactor built-in xdiff interface.
Junio C Hamano authored
7 #include "xdiff-interface.h"
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
8
9 static int uninteresting(struct diff_filepair *p)
10 {
11 if (diff_unmodified_pair(p))
12 return 1;
13 return 0;
14 }
15
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
16 static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr, int n, int num_parent)
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
17 {
18 struct diff_queue_struct *q = &diff_queued_diff;
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
19 struct combine_diff_path *p;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
20 int i;
21
22 if (!n) {
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
23 struct combine_diff_path *list = NULL, **tail = &list;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
24 for (i = 0; i < q->nr; i++) {
25 int len;
26 const char *path;
27 if (uninteresting(q->queue[i]))
28 continue;
29 path = q->queue[i]->two->path;
30 len = strlen(path);
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
31 p = xmalloc(combine_diff_path_size(num_parent, len));
32 p->path = (char*) &(p->parent[num_parent]);
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
33 memcpy(p->path, path, len);
34 p->path[len] = 0;
35 p->len = len;
36 p->next = NULL;
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
37 memset(p->parent, 0,
38 sizeof(p->parent[0]) * num_parent);
39
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
40 memcpy(p->sha1, q->queue[i]->two->sha1, 20);
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
41 p->mode = q->queue[i]->two->mode;
42 memcpy(p->parent[n].sha1, q->queue[i]->one->sha1, 20);
43 p->parent[n].mode = q->queue[i]->one->mode;
d416df8 combine-diff: Record diff status a bit more faithfully
Junio C Hamano authored
44 p->parent[n].status = q->queue[i]->status;
5290a0f combine-diff: fix appending at the tail of a list.
Junio C Hamano authored
45 *tail = p;
46 tail = &p->next;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
47 }
48 return list;
49 }
50
51 for (p = curr; p; p = p->next) {
52 int found = 0;
53 if (!p->len)
54 continue;
55 for (i = 0; i < q->nr; i++) {
56 const char *path;
57 int len;
58
59 if (uninteresting(q->queue[i]))
60 continue;
61 path = q->queue[i]->two->path;
62 len = strlen(path);
63 if (len == p->len && !memcmp(path, p->path, len)) {
64 found = 1;
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
65 memcpy(p->parent[n].sha1,
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
66 q->queue[i]->one->sha1, 20);
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
67 p->parent[n].mode = q->queue[i]->one->mode;
d416df8 combine-diff: Record diff status a bit more faithfully
Junio C Hamano authored
68 p->parent[n].status = q->queue[i]->status;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
69 break;
70 }
71 }
72 if (!found)
73 p->len = 0;
74 }
75 return curr;
76 }
77
b469d8b combine-diff: add a bit more comments.
Junio C Hamano authored
78 /* Lines lost from parent */
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
79 struct lline {
80 struct lline *next;
81 int len;
82 unsigned long parent_map;
83 char line[FLEX_ARRAY];
84 };
85
b469d8b combine-diff: add a bit more comments.
Junio C Hamano authored
86 /* Lines surviving in the merge result */
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
87 struct sline {
88 struct lline *lost_head, **lost_tail;
89 char *bol;
90 int len;
46dc941 combine-diff: cleanup.
Junio C Hamano authored
91 /* bit 0 up to (N-1) are on if the parent has this line (i.e.
92 * we did not change it).
b469d8b combine-diff: add a bit more comments.
Junio C Hamano authored
93 * bit N is used for "interesting" lines, including context.
94 */
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
95 unsigned long flag;
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
96 unsigned long *p_lno;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
97 };
98
99 static char *grab_blob(const unsigned char *sha1, unsigned long *size)
100 {
101 char *blob;
102 char type[20];
103 if (!memcmp(sha1, null_sha1, 20)) {
104 /* deleted blob */
105 *size = 0;
106 return xcalloc(1, 1);
107 }
108 blob = read_sha1_file(sha1, type, size);
8e44025 Use blob_, commit_, tag_, and tree_type throughout.
Peter Eriksen authored
109 if (strcmp(type, blob_type))
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
110 die("object '%s' is not a blob!", sha1_to_hex(sha1));
111 return blob;
112 }
113
114 static int parse_num(char **cp_p, unsigned int *num_p)
115 {
116 char *cp = *cp_p;
117 unsigned int num = 0;
118 int read_some;
119
120 while ('0' <= *cp && *cp <= '9')
121 num = num * 10 + *cp++ - '0';
122 if (!(read_some = cp - *cp_p))
123 return -1;
124 *cp_p = cp;
125 *num_p = num;
126 return 0;
127 }
128
129 static int parse_hunk_header(char *line, int len,
130 unsigned int *ob, unsigned int *on,
131 unsigned int *nb, unsigned int *nn)
132 {
133 char *cp;
134 cp = line + 4;
135 if (parse_num(&cp, ob)) {
136 bad_line:
137 return error("malformed diff output: %s", line);
138 }
139 if (*cp == ',') {
140 cp++;
141 if (parse_num(&cp, on))
142 goto bad_line;
143 }
144 else
145 *on = 1;
146 if (*cp++ != ' ' || *cp++ != '+')
147 goto bad_line;
148 if (parse_num(&cp, nb))
149 goto bad_line;
150 if (*cp == ',') {
151 cp++;
152 if (parse_num(&cp, nn))
153 goto bad_line;
154 }
155 else
156 *nn = 1;
157 return -!!memcmp(cp, " @@", 3);
158 }
159
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
160 static void append_lost(struct sline *sline, int n, const char *line, int len)
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
161 {
162 struct lline *lline;
163 unsigned long this_mask = (1UL<<n);
164 if (line[len-1] == '\n')
165 len--;
166
167 /* Check to see if we can squash things */
168 if (sline->lost_head) {
169 struct lline *last_one = NULL;
170 /* We cannot squash it with earlier one */
171 for (lline = sline->lost_head;
172 lline;
173 lline = lline->next)
174 if (lline->parent_map & this_mask)
175 last_one = lline;
176 lline = last_one ? last_one->next : sline->lost_head;
177 while (lline) {
178 if (lline->len == len &&
179 !memcmp(lline->line, line, len)) {
180 lline->parent_map |= this_mask;
181 return;
182 }
183 lline = lline->next;
184 }
185 }
186
187 lline = xmalloc(sizeof(*lline) + len + 1);
188 lline->len = len;
189 lline->next = NULL;
190 lline->parent_map = this_mask;
191 memcpy(lline->line, line, len);
192 lline->line[len] = 0;
5290a0f combine-diff: fix appending at the tail of a list.
Junio C Hamano authored
193 *sline->lost_tail = lline;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
194 sline->lost_tail = &lline->next;
195 }
196
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
197 struct combine_diff_state {
d9ea73e combine-diff: refactor built-in xdiff interface.
Junio C Hamano authored
198 struct xdiff_emit_state xm;
199
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
200 unsigned int lno, ob, on, nb, nn;
201 unsigned long nmask;
202 int num_parent;
203 int n;
204 struct sline *sline;
205 struct sline *lost_bucket;
206 };
207
d9ea73e combine-diff: refactor built-in xdiff interface.
Junio C Hamano authored
208 static void consume_line(void *state_, char *line, unsigned long len)
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
209 {
d9ea73e combine-diff: refactor built-in xdiff interface.
Junio C Hamano authored
210 struct combine_diff_state *state = state_;
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
211 if (5 < len && !memcmp("@@ -", line, 4)) {
212 if (parse_hunk_header(line, len,
213 &state->ob, &state->on,
214 &state->nb, &state->nn))
215 return;
216 state->lno = state->nb;
217 if (!state->nb)
218 /* @@ -1,2 +0,0 @@ to remove the
219 * first two lines...
220 */
221 state->nb = 1;
222 if (state->nn == 0)
223 /* @@ -X,Y +N,0 @@ removed Y lines
224 * that would have come *after* line N
225 * in the result. Our lost buckets hang
226 * to the line after the removed lines,
227 */
228 state->lost_bucket = &state->sline[state->nb];
229 else
230 state->lost_bucket = &state->sline[state->nb-1];
231 if (!state->sline[state->nb-1].p_lno)
232 state->sline[state->nb-1].p_lno =
233 xcalloc(state->num_parent,
234 sizeof(unsigned long));
235 state->sline[state->nb-1].p_lno[state->n] = state->ob;
236 return;
237 }
238 if (!state->lost_bucket)
239 return; /* not in any hunk yet */
240 switch (line[0]) {
241 case '-':
242 append_lost(state->lost_bucket, state->n, line+1, len-1);
243 break;
244 case '+':
245 state->sline[state->lno-1].flag |= state->nmask;
246 state->lno++;
247 break;
248 }
249 }
250
251 static void combine_diff(const unsigned char *parent, mmfile_t *result_file,
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
252 struct sline *sline, int cnt, int n, int num_parent)
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
253 {
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
254 unsigned int p_lno, lno;
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
255 unsigned long nmask = (1UL << n);
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
256 xpparam_t xpp;
257 xdemitconf_t xecfg;
258 mmfile_t parent_file;
259 xdemitcb_t ecb;
260 struct combine_diff_state state;
261 unsigned long sz;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
262
4462731 combine-diff: do not punt on removed or added files.
Junio C Hamano authored
263 if (!cnt)
264 return; /* result deleted */
265
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
266 parent_file.ptr = grab_blob(parent, &sz);
267 parent_file.size = sz;
268 xpp.flags = XDF_NEED_MINIMAL;
269 xecfg.ctxlen = 0;
270 xecfg.flags = 0;
d9ea73e combine-diff: refactor built-in xdiff interface.
Junio C Hamano authored
271 ecb.outf = xdiff_outf;
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
272 ecb.priv = &state;
273 memset(&state, 0, sizeof(state));
d9ea73e combine-diff: refactor built-in xdiff interface.
Junio C Hamano authored
274 state.xm.consume = consume_line;
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
275 state.nmask = nmask;
276 state.sline = sline;
277 state.lno = 1;
278 state.num_parent = num_parent;
279 state.n = n;
280
281 xdl_diff(&parent_file, result_file, &xpp, &xecfg, &ecb);
282 free(parent_file.ptr);
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
283
284 /* Assign line numbers for this parent.
285 *
286 * sline[lno].p_lno[n] records the first line number
287 * (counting from 1) for parent N if the final hunk display
288 * started by showing sline[lno] (possibly showing the lost
289 * lines attached to it first).
290 */
291 for (lno = 0, p_lno = 1; lno < cnt; lno++) {
292 struct lline *ll;
293 sline[lno].p_lno[n] = p_lno;
294
295 /* How many lines would this sline advance the p_lno? */
296 ll = sline[lno].lost_head;
297 while (ll) {
298 if (ll->parent_map & nmask)
299 p_lno++; /* '-' means parent had it */
300 ll = ll->next;
301 }
46dc941 combine-diff: cleanup.
Junio C Hamano authored
302 if (!(sline[lno].flag & nmask))
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
303 p_lno++; /* no '+' means parent had it */
304 }
305 sline[lno].p_lno[n] = p_lno; /* trailer */
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
306 }
307
308 static unsigned long context = 3;
309 static char combine_marker = '@';
310
311 static int interesting(struct sline *sline, unsigned long all_mask)
312 {
46dc941 combine-diff: cleanup.
Junio C Hamano authored
313 /* If some parents lost lines here, or if we have added to
314 * some parent, it is interesting.
315 */
316 return ((sline->flag & all_mask) || sline->lost_head);
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
317 }
318
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
319 static unsigned long adjust_hunk_tail(struct sline *sline,
320 unsigned long all_mask,
321 unsigned long hunk_begin,
322 unsigned long i)
323 {
46dc941 combine-diff: cleanup.
Junio C Hamano authored
324 /* i points at the first uninteresting line. If the last line
325 * of the hunk was interesting only because it has some
326 * deletion, then it is not all that interesting for the
327 * purpose of giving trailing context lines. This is because
328 * we output '-' line and then unmodified sline[i-1] itself in
329 * that case which gives us one extra context line.
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
330 */
46dc941 combine-diff: cleanup.
Junio C Hamano authored
331 if ((hunk_begin + 1 <= i) && !(sline[i-1].flag & all_mask))
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
332 i--;
333 return i;
334 }
335
46dc941 combine-diff: cleanup.
Junio C Hamano authored
336 static unsigned long find_next(struct sline *sline,
337 unsigned long mark,
338 unsigned long i,
339 unsigned long cnt,
340 int uninteresting)
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
341 {
46dc941 combine-diff: cleanup.
Junio C Hamano authored
342 /* We have examined up to i-1 and are about to look at i.
343 * Find next interesting or uninteresting line. Here,
344 * "interesting" does not mean interesting(), but marked by
345 * the give_context() function below (i.e. it includes context
346 * lines that are not interesting to interesting() function
347 * that are surrounded by interesting() ones.
348 */
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
349 while (i < cnt)
46dc941 combine-diff: cleanup.
Junio C Hamano authored
350 if (uninteresting
351 ? !(sline[i].flag & mark)
352 : (sline[i].flag & mark))
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
353 return i;
354 else
355 i++;
356 return cnt;
357 }
358
359 static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
360 {
361 unsigned long all_mask = (1UL<<num_parent) - 1;
362 unsigned long mark = (1UL<<num_parent);
363 unsigned long i;
364
46dc941 combine-diff: cleanup.
Junio C Hamano authored
365 /* Two groups of interesting lines may have a short gap of
366 * unintersting lines. Connect such groups to give them a
367 * bit of context.
368 *
369 * We first start from what the interesting() function says,
370 * and mark them with "mark", and paint context lines with the
371 * mark. So interesting() would still say false for such context
372 * lines but they are treated as "interesting" in the end.
373 */
374 i = find_next(sline, mark, 0, cnt, 0);
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
375 if (cnt <= i)
376 return 0;
377
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
378 while (i < cnt) {
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
379 unsigned long j = (context < i) ? (i - context) : 0;
380 unsigned long k;
46dc941 combine-diff: cleanup.
Junio C Hamano authored
381
382 /* Paint a few lines before the first interesting line. */
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
383 while (j < i)
384 sline[j++].flag |= mark;
385
386 again:
46dc941 combine-diff: cleanup.
Junio C Hamano authored
387 /* we know up to i is to be included. where does the
388 * next uninteresting one start?
389 */
390 j = find_next(sline, mark, i, cnt, 1);
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
391 if (cnt <= j)
392 break; /* the rest are all interesting */
393
394 /* lookahead context lines */
46dc941 combine-diff: cleanup.
Junio C Hamano authored
395 k = find_next(sline, mark, j, cnt, 0);
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
396 j = adjust_hunk_tail(sline, all_mask, i, j);
397
398 if (k < j + context) {
399 /* k is interesting and [j,k) are not, but
400 * paint them interesting because the gap is small.
401 */
402 while (j < k)
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
403 sline[j++].flag |= mark;
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
404 i = k;
405 goto again;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
406 }
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
407
408 /* j is the first uninteresting line and there is
46dc941 combine-diff: cleanup.
Junio C Hamano authored
409 * no overlap beyond it within context lines. Paint
410 * the trailing edge a bit.
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
411 */
412 i = k;
413 k = (j + context < cnt) ? j + context : cnt;
414 while (j < k)
415 sline[j++].flag |= mark;
416 }
417 return 1;
418 }
419
420 static int make_hunks(struct sline *sline, unsigned long cnt,
421 int num_parent, int dense)
422 {
423 unsigned long all_mask = (1UL<<num_parent) - 1;
424 unsigned long mark = (1UL<<num_parent);
425 unsigned long i;
426 int has_interesting = 0;
427
428 for (i = 0; i < cnt; i++) {
429 if (interesting(&sline[i], all_mask))
430 sline[i].flag |= mark;
431 else
432 sline[i].flag &= ~mark;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
433 }
d8f4790 diff-tree --cc: denser combined diff output for a merge commit.
Junio C Hamano authored
434 if (!dense)
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
435 return give_context(sline, cnt, num_parent);
d8f4790 diff-tree --cc: denser combined diff output for a merge commit.
Junio C Hamano authored
436
263eee2 combine-diff: extend --cc logic to Octopus.
Junio C Hamano authored
437 /* Look at each hunk, and if we have changes from only one
438 * parent, or the changes are the same from all but one
439 * parent, mark that uninteresting.
d8f4790 diff-tree --cc: denser combined diff output for a merge commit.
Junio C Hamano authored
440 */
441 i = 0;
442 while (i < cnt) {
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
443 unsigned long j, hunk_begin, hunk_end;
bf1c32b combine-diff: update --cc "uninteresting hunks" logic.
Junio C Hamano authored
444 unsigned long same_diff;
d8f4790 diff-tree --cc: denser combined diff output for a merge commit.
Junio C Hamano authored
445 while (i < cnt && !(sline[i].flag & mark))
446 i++;
447 if (cnt <= i)
448 break; /* No more interesting hunks */
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
449 hunk_begin = i;
450 for (j = i + 1; j < cnt; j++) {
451 if (!(sline[j].flag & mark)) {
452 /* Look beyond the end to see if there
453 * is an interesting line after this
454 * hunk within context span.
455 */
456 unsigned long la; /* lookahead */
457 int contin = 0;
458 la = adjust_hunk_tail(sline, all_mask,
459 hunk_begin, j);
460 la = (la + context < cnt) ?
461 (la + context) : cnt;
462 while (j <= --la) {
463 if (sline[la].flag & mark) {
464 contin = 1;
465 break;
466 }
467 }
468 if (!contin)
469 break;
470 j = la;
471 }
472 }
473 hunk_end = j;
474
bf1c32b combine-diff: update --cc "uninteresting hunks" logic.
Junio C Hamano authored
475 /* [i..hunk_end) are interesting. Now is it really
fd4b1d2 combine-diff: add safety check to --cc.
Junio C Hamano authored
476 * interesting? We check if there are only two versions
477 * and the result matches one of them. That is, we look
478 * at:
479 * (+) line, which records lines added to which parents;
480 * this line appears in the result.
481 * (-) line, which records from what parents the line
482 * was removed; this line does not appear in the result.
483 * then check the set of parents the result has difference
484 * from, from all lines. If there are lines that has
485 * different set of parents that the result has differences
486 * from, that means we have more than two versions.
487 *
488 * Even when we have only two versions, if the result does
489 * not match any of the parents, the it should be considered
490 * interesting. In such a case, we would have all '+' line.
491 * After passing the above "two versions" test, that would
492 * appear as "the same set of parents" to be "all parents".
d8f4790 diff-tree --cc: denser combined diff output for a merge commit.
Junio C Hamano authored
493 */
bf1c32b combine-diff: update --cc "uninteresting hunks" logic.
Junio C Hamano authored
494 same_diff = 0;
495 has_interesting = 0;
496 for (j = i; j < hunk_end && !has_interesting; j++) {
46dc941 combine-diff: cleanup.
Junio C Hamano authored
497 unsigned long this_diff = sline[j].flag & all_mask;
bf1c32b combine-diff: update --cc "uninteresting hunks" logic.
Junio C Hamano authored
498 struct lline *ll = sline[j].lost_head;
499 if (this_diff) {
500 /* This has some changes. Is it the
501 * same as others?
502 */
503 if (!same_diff)
504 same_diff = this_diff;
505 else if (same_diff != this_diff) {
506 has_interesting = 1;
507 break;
508 }
509 }
510 while (ll && !has_interesting) {
511 /* Lost this line from these parents;
512 * who are they? Are they the same?
513 */
514 this_diff = ll->parent_map;
515 if (!same_diff)
516 same_diff = this_diff;
517 else if (same_diff != this_diff) {
518 has_interesting = 1;
519 }
520 ll = ll->next;
521 }
d8f4790 diff-tree --cc: denser combined diff output for a merge commit.
Junio C Hamano authored
522 }
bf1c32b combine-diff: update --cc "uninteresting hunks" logic.
Junio C Hamano authored
523
fd4b1d2 combine-diff: add safety check to --cc.
Junio C Hamano authored
524 if (!has_interesting && same_diff != all_mask) {
d8f4790 diff-tree --cc: denser combined diff output for a merge commit.
Junio C Hamano authored
525 /* This hunk is not that interesting after all */
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
526 for (j = hunk_begin; j < hunk_end; j++)
d8f4790 diff-tree --cc: denser combined diff output for a merge commit.
Junio C Hamano authored
527 sline[j].flag &= ~mark;
528 }
529 i = hunk_end;
530 }
3ec1909 combine-diff: better hunk splitting.
Junio C Hamano authored
531
532 has_interesting = give_context(sline, cnt, num_parent);
8828cdc diff-tree --cc: squelch header generation on empty patch.
Junio C Hamano authored
533 return has_interesting;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
534 }
535
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
536 static void show_parent_lno(struct sline *sline, unsigned long l0, unsigned long l1, unsigned long cnt, int n)
537 {
538 l0 = sline[l0].p_lno[n];
539 l1 = sline[l1].p_lno[n];
f7a3d33 combine-diff: finishing touches to git-diff-tree --cc
Junio C Hamano authored
540 printf(" -%lu,%lu", l0, l1-l0);
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
541 }
542
543 static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent)
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
544 {
545 unsigned long mark = (1UL<<num_parent);
546 int i;
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
547 unsigned long lno = 0;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
548
4462731 combine-diff: do not punt on removed or added files.
Junio C Hamano authored
549 if (!cnt)
550 return; /* result deleted */
551
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
552 while (1) {
553 struct sline *sl = &sline[lno];
554 int hunk_end;
555 while (lno < cnt && !(sline[lno].flag & mark))
556 lno++;
557 if (cnt <= lno)
558 break;
559 for (hunk_end = lno + 1; hunk_end < cnt; hunk_end++)
560 if (!(sline[hunk_end].flag & mark))
561 break;
562 for (i = 0; i <= num_parent; i++) putchar(combine_marker);
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
563 for (i = 0; i < num_parent; i++)
564 show_parent_lno(sline, lno, hunk_end, cnt, i);
f7a3d33 combine-diff: finishing touches to git-diff-tree --cc
Junio C Hamano authored
565 printf(" +%lu,%lu ", lno+1, hunk_end-lno);
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
566 for (i = 0; i <= num_parent; i++) putchar(combine_marker);
567 putchar('\n');
568 while (lno < hunk_end) {
569 struct lline *ll;
570 int j;
46dc941 combine-diff: cleanup.
Junio C Hamano authored
571 unsigned long p_mask;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
572 sl = &sline[lno++];
573 ll = sl->lost_head;
574 while (ll) {
575 for (j = 0; j < num_parent; j++) {
576 if (ll->parent_map & (1UL<<j))
577 putchar('-');
578 else
579 putchar(' ');
580 }
581 puts(ll->line);
582 ll = ll->next;
583 }
46dc941 combine-diff: cleanup.
Junio C Hamano authored
584 p_mask = 1;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
585 for (j = 0; j < num_parent; j++) {
46dc941 combine-diff: cleanup.
Junio C Hamano authored
586 if (p_mask & sl->flag)
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
587 putchar('+');
46dc941 combine-diff: cleanup.
Junio C Hamano authored
588 else
589 putchar(' ');
590 p_mask <<= 1;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
591 }
e228340 combine-diff: minor output changes.
Junio C Hamano authored
592 printf("%.*s\n", sl->len, sl->bol);
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
593 }
594 }
595 }
596
3c39e9b combine-diff: reuse diff from the same blob.
Junio C Hamano authored
597 static void reuse_combine_diff(struct sline *sline, unsigned long cnt,
598 int i, int j)
599 {
600 /* We have already examined parent j and we know parent i
601 * and parent j are the same, so reuse the combined result
602 * of parent j for parent i.
603 */
604 unsigned long lno, imask, jmask;
605 imask = (1UL<<i);
606 jmask = (1UL<<j);
607
608 for (lno = 0; lno < cnt; lno++) {
609 struct lline *ll = sline->lost_head;
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
610 sline->p_lno[i] = sline->p_lno[j];
3c39e9b combine-diff: reuse diff from the same blob.
Junio C Hamano authored
611 while (ll) {
612 if (ll->parent_map & jmask)
613 ll->parent_map |= imask;
614 ll = ll->next;
615 }
46dc941 combine-diff: cleanup.
Junio C Hamano authored
616 if (sline->flag & jmask)
617 sline->flag |= imask;
3c39e9b combine-diff: reuse diff from the same blob.
Junio C Hamano authored
618 sline++;
619 }
4462731 combine-diff: do not punt on removed or added files.
Junio C Hamano authored
620 /* the overall size of the file (sline[cnt]) */
621 sline->p_lno[i] = sline->p_lno[j];
3c39e9b combine-diff: reuse diff from the same blob.
Junio C Hamano authored
622 }
623
0a79807 combine-diff: move formatting logic to show_combined_diff()
Junio C Hamano authored
624 static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
e70c6b3 combine-diff: Honour --full-index.
Mark Wooding authored
625 int dense, const char *header,
626 struct diff_options *opt)
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
627 {
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
628 unsigned long result_size, cnt, lno;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
629 char *result, *cp, *ep;
630 struct sline *sline; /* survived lines */
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
631 int mode_differs = 0;
8828cdc diff-tree --cc: squelch header generation on empty patch.
Junio C Hamano authored
632 int i, show_hunks, shown_header = 0;
713a11f combine-diff: diff-files fix.
Junio C Hamano authored
633 int working_tree_file = !memcmp(elem->sha1, null_sha1, 20);
e70c6b3 combine-diff: Honour --full-index.
Mark Wooding authored
634 int abbrev = opt->full_index ? 40 : DEFAULT_ABBREV;
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
635 mmfile_t result_file;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
636
637 /* Read the result of merge first */
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
638 if (!working_tree_file)
639 result = grab_blob(elem->sha1, &result_size);
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
640 else {
9843a1f combine-diff: do not send NULL to printf
Junio C Hamano authored
641 /* Used by diff-tree to read from the working tree */
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
642 struct stat st;
643 int fd;
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
644 if (0 <= (fd = open(elem->path, O_RDONLY)) &&
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
645 !fstat(fd, &st)) {
646 int len = st.st_size;
647 int cnt = 0;
648
1b0c717 tree/diff header cleanup.
Junio C Hamano authored
649 elem->mode = canon_mode(st.st_mode);
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
650 result_size = len;
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
651 result = xmalloc(len + 1);
652 while (cnt < len) {
653 int done = xread(fd, result+cnt, len-cnt);
654 if (done == 0)
655 break;
656 if (done < 0)
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
657 die("read error '%s'", elem->path);
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
658 cnt += done;
659 }
660 result[len] = 0;
661 }
662 else {
663 /* deleted file */
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
664 result_size = 0;
713a11f combine-diff: diff-files fix.
Junio C Hamano authored
665 elem->mode = 0;
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
666 result = xmalloc(1);
667 result[0] = 0;
668 }
669 if (0 <= fd)
670 close(fd);
671 }
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
672
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
673 for (cnt = 0, cp = result; cp - result < result_size; cp++) {
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
674 if (*cp == '\n')
675 cnt++;
676 }
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
677 if (result_size && result[result_size-1] != '\n')
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
678 cnt++; /* incomplete line */
679
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
680 sline = xcalloc(cnt+1, sizeof(*sline));
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
681 ep = result;
682 sline[0].bol = result;
4462731 combine-diff: do not punt on removed or added files.
Junio C Hamano authored
683 for (lno = 0; lno <= cnt; lno++) {
684 sline[lno].lost_tail = &sline[lno].lost_head;
685 sline[lno].flag = 0;
686 }
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
687 for (lno = 0, cp = result; cp - result < result_size; cp++) {
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
688 if (*cp == '\n') {
689 sline[lno].len = cp - sline[lno].bol;
690 lno++;
691 if (lno < cnt)
692 sline[lno].bol = cp + 1;
693 }
694 }
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
695 if (result_size && result[result_size-1] != '\n')
696 sline[cnt-1].len = result_size - (sline[cnt-1].bol - result);
697
698 result_file.ptr = result;
699 result_file.size = result_size;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
700
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
701 sline[0].p_lno = xcalloc((cnt+1) * num_parent, sizeof(unsigned long));
702 for (lno = 0; lno < cnt; lno++)
703 sline[lno+1].p_lno = sline[lno].p_lno + num_parent;
704
3c39e9b combine-diff: reuse diff from the same blob.
Junio C Hamano authored
705 for (i = 0; i < num_parent; i++) {
706 int j;
707 for (j = 0; j < i; j++) {
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
708 if (!memcmp(elem->parent[i].sha1,
709 elem->parent[j].sha1, 20)) {
3c39e9b combine-diff: reuse diff from the same blob.
Junio C Hamano authored
710 reuse_combine_diff(sline, cnt, i, j);
711 break;
712 }
713 }
714 if (i <= j)
f23fc77 combine-diff: use built-in xdiff.
Junio C Hamano authored
715 combine_diff(elem->parent[i].sha1, &result_file, sline,
f16706c combine-diff: show parent line numbers as well.
Junio C Hamano authored
716 cnt, i, num_parent);
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
717 if (elem->parent[i].mode != elem->mode)
718 mode_differs = 1;
3c39e9b combine-diff: reuse diff from the same blob.
Junio C Hamano authored
719 }
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
720
8828cdc diff-tree --cc: squelch header generation on empty patch.
Junio C Hamano authored
721 show_hunks = make_hunks(sline, cnt, num_parent, dense);
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
722
713a11f combine-diff: diff-files fix.
Junio C Hamano authored
723 if (show_hunks || mode_differs || working_tree_file) {
9843a1f combine-diff: do not send NULL to printf
Junio C Hamano authored
724 const char *abb;
725
46dc941 combine-diff: cleanup.
Junio C Hamano authored
726 if (header) {
727 shown_header++;
6baf048 combine-diff: Honour -z option correctly.
Mark Wooding authored
728 printf("%s%c", header, opt->line_termination);
46dc941 combine-diff: cleanup.
Junio C Hamano authored
729 }
8828cdc diff-tree --cc: squelch header generation on empty patch.
Junio C Hamano authored
730 printf("diff --%s ", dense ? "cc" : "combined");
731 if (quote_c_style(elem->path, NULL, NULL, 0))
732 quote_c_style(elem->path, NULL, stdout, 0);
733 else
734 printf("%s", elem->path);
735 putchar('\n');
823bcd6 combine-diff: fix placement of deletion.
Junio C Hamano authored
736 printf("index ");
737 for (i = 0; i < num_parent; i++) {
297a1aa find_unique_abbrev() simplification.
Junio C Hamano authored
738 abb = find_unique_abbrev(elem->parent[i].sha1,
e70c6b3 combine-diff: Honour --full-index.
Mark Wooding authored
739 abbrev);
9843a1f combine-diff: do not send NULL to printf
Junio C Hamano authored
740 printf("%s%s", i ? "," : "", abb);
823bcd6 combine-diff: fix placement of deletion.
Junio C Hamano authored
741 }
e70c6b3 combine-diff: Honour --full-index.
Mark Wooding authored
742 abb = find_unique_abbrev(elem->sha1, abbrev);
9843a1f combine-diff: do not send NULL to printf
Junio C Hamano authored
743 printf("..%s\n", abb);
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
744
745 if (mode_differs) {
d416df8 combine-diff: Record diff status a bit more faithfully
Junio C Hamano authored
746 int added = !!elem->mode;
747 for (i = 0; added && i < num_parent; i++)
748 if (elem->parent[i].status !=
749 DIFF_STATUS_ADDED)
750 added = 0;
751 if (added)
752 printf("new file mode %06o", elem->mode);
753 else {
754 if (!elem->mode)
755 printf("deleted file ");
756 printf("mode ");
757 for (i = 0; i < num_parent; i++) {
758 printf("%s%06o", i ? "," : "",
759 elem->parent[i].mode);
760 }
761 if (elem->mode)
762 printf("..%06o", elem->mode);
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
763 }
d416df8 combine-diff: Record diff status a bit more faithfully
Junio C Hamano authored
764 putchar('\n');
2454c96 combine-diff: show mode changes as well.
Junio C Hamano authored
765 }
8828cdc diff-tree --cc: squelch header generation on empty patch.
Junio C Hamano authored
766 dump_sline(sline, cnt, num_parent);
767 }
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
768 free(result);
769
770 for (i = 0; i < cnt; i++) {
771 if (sline[i].lost_head) {
772 struct lline *ll = sline[i].lost_head;
773 while (ll) {
774 struct lline *tmp = ll;
775 ll = ll->next;
776 free(tmp);
777 }
778 }
779 }
46dc941 combine-diff: cleanup.
Junio C Hamano authored
780 free(sline[0].p_lno);
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
781 free(sline);
8828cdc diff-tree --cc: squelch header generation on empty patch.
Junio C Hamano authored
782 return shown_header;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
783 }
784
ee63802 diff-tree -c raw output
Linus Torvalds authored
785 #define COLONS "::::::::::::::::::::::::::::::::"
786
787 static void show_raw_diff(struct combine_diff_path *p, int num_parent, const char *header, struct diff_options *opt)
788 {
789 int i, offset, mod_type = 'A';
790 const char *prefix;
791 int line_termination, inter_name_termination;
792
793 line_termination = opt->line_termination;
794 inter_name_termination = '\t';
795 if (!line_termination)
796 inter_name_termination = 0;
797
798 if (header)
6baf048 combine-diff: Honour -z option correctly.
Mark Wooding authored
799 printf("%s%c", header, line_termination);
ee63802 diff-tree -c raw output
Linus Torvalds authored
800
801 for (i = 0; i < num_parent; i++) {
0a79807 combine-diff: move formatting logic to show_combined_diff()
Junio C Hamano authored
802 if (p->parent[i].mode)
ee63802 diff-tree -c raw output
Linus Torvalds authored
803 mod_type = 'M';
804 }
805 if (!p->mode)
806 mod_type = 'D';
807
0a79807 combine-diff: move formatting logic to show_combined_diff()
Junio C Hamano authored
808 if (opt->output_format == DIFF_FORMAT_RAW) {
809 offset = strlen(COLONS) - num_parent;
810 if (offset < 0)
811 offset = 0;
812 prefix = COLONS + offset;
813
814 /* Show the modes */
815 for (i = 0; i < num_parent; i++) {
816 printf("%s%06o", prefix, p->parent[i].mode);
817 prefix = " ";
818 }
819 printf("%s%06o", prefix, p->mode);
820
821 /* Show sha1's */
822 for (i = 0; i < num_parent; i++)
823 printf(" %s", diff_unique_abbrev(p->parent[i].sha1,
824 opt->abbrev));
825 printf(" %s ", diff_unique_abbrev(p->sha1, opt->abbrev));
826 }
827
828 if (opt->output_format == DIFF_FORMAT_RAW ||
d416df8 combine-diff: Record diff status a bit more faithfully
Junio C Hamano authored
829 opt->output_format == DIFF_FORMAT_NAME_STATUS) {
830 for (i = 0; i < num_parent; i++)
831 putchar(p->parent[i].status);
832 putchar(inter_name_termination);
833 }
0a79807 combine-diff: move formatting logic to show_combined_diff()
Junio C Hamano authored
834
835 if (line_termination) {
836 if (quote_c_style(p->path, NULL, NULL, 0))
837 quote_c_style(p->path, NULL, stdout, 0);
838 else
839 printf("%s", p->path);
840 putchar(line_termination);
841 }
842 else {
843 printf("%s%c", p->path, line_termination);
ee63802 diff-tree -c raw output
Linus Torvalds authored
844 }
0a79807 combine-diff: move formatting logic to show_combined_diff()
Junio C Hamano authored
845 }
846
847 int show_combined_diff(struct combine_diff_path *p,
848 int num_parent,
849 int dense,
850 const char *header,
851 struct diff_options *opt)
852 {
853 if (!p->len)
854 return 0;
855 switch (opt->output_format) {
856 case DIFF_FORMAT_RAW:
857 case DIFF_FORMAT_NAME_STATUS:
858 case DIFF_FORMAT_NAME:
859 show_raw_diff(p, num_parent, header, opt);
860 return 1;
ee63802 diff-tree -c raw output
Linus Torvalds authored
861
0a79807 combine-diff: move formatting logic to show_combined_diff()
Junio C Hamano authored
862 default:
863 case DIFF_FORMAT_PATCH:
e70c6b3 combine-diff: Honour --full-index.
Mark Wooding authored
864 return show_patch_diff(p, num_parent, dense, header, opt);
0a79807 combine-diff: move formatting logic to show_combined_diff()
Junio C Hamano authored
865 }
ee63802 diff-tree -c raw output
Linus Torvalds authored
866 }
867
868 const char *diff_tree_combined_merge(const unsigned char *sha1,
869 const char *header, int dense,
870 struct diff_options *opt)
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
871 {
872 struct commit *commit = lookup_commit(sha1);
873 struct diff_options diffopts;
874 struct commit_list *parents;
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
875 struct combine_diff_path *p, *paths = NULL;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
876 int num_parent, i, num_paths;
877
5b23683 combined-diff: use diffcore before intersecting paths.
Junio C Hamano authored
878 diffopts = *opt;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
879 diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
880 diffopts.recursive = 1;
881
882 /* count parents */
883 for (parents = commit->parents, num_parent = 0;
884 parents;
885 parents = parents->next, num_parent++)
886 ; /* nothing */
887
888 /* find set of paths that everybody touches */
889 for (parents = commit->parents, i = 0;
890 parents;
891 parents = parents->next, i++) {
892 struct commit *parent = parents->item;
893 diff_tree_sha1(parent->object.sha1, commit->object.sha1, "",
894 &diffopts);
5b23683 combined-diff: use diffcore before intersecting paths.
Junio C Hamano authored
895 diffcore_std(&diffopts);
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
896 paths = intersect_paths(paths, i, num_parent);
897 diff_flush(&diffopts);
898 }
899
900 /* find out surviving paths */
901 for (num_paths = 0, p = paths; p; p = p->next) {
902 if (p->len)
903 num_paths++;
904 }
e3c3a55 combine-diff: remove misguided --show-empty hack.
Junio C Hamano authored
905 if (num_paths) {
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
906 for (p = paths; p; p = p->next) {
0a79807 combine-diff: move formatting logic to show_combined_diff()
Junio C Hamano authored
907 if (show_combined_diff(p, num_parent, dense,
908 header, opt))
8828cdc diff-tree --cc: squelch header generation on empty patch.
Junio C Hamano authored
909 header = NULL;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
910 }
911 }
912
913 /* Clean things up */
914 while (paths) {
ea726d0 diff-files: -c and --cc options.
Junio C Hamano authored
915 struct combine_diff_path *tmp = paths;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
916 paths = paths->next;
917 free(tmp);
918 }
ee63802 diff-tree -c raw output
Linus Torvalds authored
919 return header;
af3feef diff-tree -c: show a merge commit a bit more sensibly.
Junio C Hamano authored
920 }
Something went wrong with that request. Please try again.