768
*cache = new_entry;
769
}
770
771
-static int add_parents_to_list(struct rev_info *revs, struct commit *commit,
772
- struct commit_list **list, struct commit_list **cache_ptr)
771
+static int process_parents(struct rev_info *revs, struct commit *commit,
772
+ struct commit_list **list, struct commit_list **cache_ptr)
773
{
774
struct commit_list *parent = commit->parents;
775
unsigned left_flag;
808
if (p->object.flags & SEEN)
809
continue;
810
p->object.flags |= SEEN;
811
- commit_list_insert_by_date_cached(p, list, cached_base, cache_ptr);
811
+ if (list)
812
+ commit_list_insert_by_date_cached(p, list, cached_base, cache_ptr);
813
}
814
return 0;
815
}
848
p->object.flags |= left_flag;
849
if (!(p->object.flags & SEEN)) {
850
p->object.flags |= SEEN;
850
- commit_list_insert_by_date_cached(p, list, cached_base, cache_ptr);
851
+ if (list)
852
+ commit_list_insert_by_date_cached(p, list, cached_base, cache_ptr);
853
}
854
if (revs->first_parent_only)
855
break;
1093
1094
if (revs->max_age != -1 && (commit->date < revs->max_age))
1095
obj->flags |= UNINTERESTING;
1094
- if (add_parents_to_list(revs, commit, &list, NULL) < 0)
1096
+ if (process_parents(revs, commit, &list, NULL) < 0)
1097
return -1;
1098
if (obj->flags & UNINTERESTING) {
1099
mark_parents_uninteresting(commit);
2915
2916
static void expand_topo_walk(struct rev_info *revs, struct commit *commit)
2917
{
2916
- if (add_parents_to_list(revs, commit, &revs->commits, NULL) < 0) {
2918
+ if (process_parents(revs, commit, &revs->commits, NULL) < 0) {
2919
if (!revs->ignore_missing_links)
2920
die("Failed to traverse parents of commit %s",
2921
oid_to_hex(&commit->object.oid));
2981
for (;;) {
2982
struct commit *p = *pp;
2983
if (!revs->limited)
2982
- if (add_parents_to_list(revs, p, &revs->commits, &cache) < 0)
2984
+ if (process_parents(revs, p, &revs->commits, &cache) < 0)
2985
return rewrite_one_error;
2986
if (p->object.flags & UNINTERESTING)
2987
return rewrite_one_ok;
3314
try_to_simplify_commit(revs, commit);
3315
else if (revs->topo_walk_info)
3316
expand_topo_walk(revs, commit);
3315
- else if (add_parents_to_list(revs, commit, &revs->commits, NULL) < 0) {
3317
+ else if (process_parents(revs, commit, &revs->commits, NULL) < 0) {
3318
if (!revs->ignore_missing_links)
3319
die("Failed to traverse parents of commit %s",
3320
oid_to_hex(&commit->object.oid));