+ if (!dense)
+ return;
+
+ /* Look at each hunk, and if it contains changes from only
+ * one parent, mark that uninteresting.
+ */
+ i = 0;
+ while (i < cnt) {
+ int j, hunk_end, diffs;
+ unsigned long parents;
+ while (i < cnt && !(sline[i].flag & mark))
+ i++;
+ if (cnt <= i)
+ break; /* No more interesting hunks */
+ for (hunk_end = i + 1; hunk_end < cnt; hunk_end++)
+ if (!(sline[hunk_end].flag & mark))
+ break;
+ /* [i..hunk_end) are interesting. Now is it from
+ * only one parent?
+ * If lost lines are only from one parent and
+ * remaining lines existed in parents other than
+ * that parent, then the hunk is not that interesting.
+ */
+ parents = 0;
+ diffs = 0;
+ for (j = i; j < hunk_end; j++)
+ parents |= line_diff_parents(sline + j, all_mask);
+ /* Now, how many bits from [0..num_parent) are on? */
+ for (j = 0; j < num_parent; j++) {
+ if (parents & (1UL<<j))
+ diffs++;
+ }
+ if (diffs < 2) {
+ /* This hunk is not that interesting after all */
+ for (j = i; j < hunk_end; j++)
+ sline[j].flag &= ~mark;
+ }
+ i = hunk_end;
+ }