oid_to_hex(&c->object.oid));
for (parent = c->parents; parent; parent = parent->next)
- if (!(parent->item->object.flags & not_shallow_flag)) {
+ if (parent->item->object.flags & not_shallow_flag) {
+ must_not_be_shallow = 1;
+ } else {
c->object.flags |= shallow_flag;
- commit_list_insert(c, &result);
- break;
+ parent->item->object.flags |= shallow_flag;
}
+ if (must_not_be_shallow) {
+ c->object.flags &= ~shallow_flag;
+ for (parent = c->parents; parent; parent = parent->next)
+ if (parent->item->object.flags & shallow_flag) {
+ parent->item->object.flags |= not_shallow_flag;
+ commit_list_insert(parent->item, &result);
+ }
+ } else {
+ for (parent = c->parents; parent; parent = parent->next)
+ parent->item->object.flags &= ~shallow_flag;
+ commit_list_insert(c, &result);
+ }
}
- free_commit_list(not_shallow_list);
+ commit_list_free(not_shallow_list);
/*
* Now we can clean up NOT_SHALLOW on border commits. Having