-static void mark_edges_uninteresting(struct commit_list *list)
-{
- for ( ; list; list = list->next) {
- struct commit_list *parents = list->item->parents;
-
- for ( ; parents; parents = parents->next) {
- struct commit *commit = parents->item;
- if (commit->object.flags & UNINTERESTING)
- mark_tree_uninteresting(commit->tree);
- }
- }
-}
-
-static int is_different = 0;
-
-static void file_add_remove(struct diff_options *options,
- int addremove, unsigned mode,
- const unsigned char *sha1,
- const char *base, const char *path)
-{
- is_different = 1;
-}
-
-static void file_change(struct diff_options *options,
- unsigned old_mode, unsigned new_mode,
- const unsigned char *old_sha1,
- const unsigned char *new_sha1,
- const char *base, const char *path)
-{
- is_different = 1;
-}
-
-static struct diff_options diff_opt = {
- .recursive = 1,
- .add_remove = file_add_remove,
- .change = file_change,
-};
-
-static int same_tree(struct tree *t1, struct tree *t2)
-{
- is_different = 0;
- if (diff_tree_sha1(t1->object.sha1, t2->object.sha1, "", &diff_opt) < 0)
- return 0;
- return !is_different;
-}
-
-static int same_tree_as_empty(struct tree *t1)
-{
- int retval;
- void *tree;
- struct tree_desc empty, real;
-
- if (!t1)
- return 0;
-
- tree = read_object_with_reference(t1->object.sha1, "tree", &real.size, NULL);
- if (!tree)
- return 0;
- real.buf = tree;
-
- empty.buf = "";
- empty.size = 0;
-
- is_different = 0;
- retval = diff_tree(&empty, &real, "", &diff_opt);
- free(tree);
-
- return retval >= 0 && !is_different;
-}
-
-static struct commit *try_to_simplify_merge(struct commit *commit, struct commit_list *parent)
-{
- if (!commit->tree)
- return NULL;
-
- while (parent) {
- struct commit *p = parent->item;
- parent = parent->next;
- parse_commit(p);
- if (!p->tree)
- continue;
- if (same_tree(commit->tree, p->tree))
- return p;
- }
- return NULL;
-}
-
-static void add_parents_to_list(struct commit *commit, struct commit_list **list)