+ hunk_end = j;
+
+ /* [i..hunk_end) are interesting. Now is it really
+ * interesting? We check if there are only two versions
+ * and the result matches one of them. That is, we look
+ * at:
+ * (+) line, which records lines added to which parents;
+ * this line appears in the result.
+ * (-) line, which records from what parents the line
+ * was removed; this line does not appear in the result.
+ * then check the set of parents the result has difference
+ * from, from all lines. If there are lines that has
+ * different set of parents that the result has differences
+ * from, that means we have more than two versions.
+ *
+ * Even when we have only two versions, if the result does
+ * not match any of the parents, the it should be considered
+ * interesting. In such a case, we would have all '+' line.
+ * After passing the above "two versions" test, that would
+ * appear as "the same set of parents" to be "all parents".
+ */
+ same_diff = 0;
+ has_interesting = 0;
+ for (j = i; j < hunk_end && !has_interesting; j++) {
+ unsigned long this_diff = sline[j].flag & all_mask;
+ struct lline *ll = sline[j].lost_head;
+ if (this_diff) {
+ /* This has some changes. Is it the
+ * same as others?
+ */
+ if (!same_diff)
+ same_diff = this_diff;
+ else if (same_diff != this_diff) {
+ has_interesting = 1;
+ break;
+ }
+ }
+ while (ll && !has_interesting) {
+ /* Lost this line from these parents;
+ * who are they? Are they the same?
+ */
+ this_diff = ll->parent_map;
+ if (!same_diff)
+ same_diff = this_diff;
+ else if (same_diff != this_diff) {
+ has_interesting = 1;
+ }
+ ll = ll->next;
+ }