273
stack->nr = stack->alloc = 0;
274
}
275
276
-static void mark_one_parent_uninteresting(struct commit *commit,
276
+static void mark_one_parent_uninteresting(struct rev_info *revs, struct commit *commit,
277
struct commit_stack *pending)
278
{
279
struct commit_list *l;
290
* wasn't uninteresting), in which case we need
291
* to mark its parents recursively too..
292
*/
293
- for (l = commit->parents; l; l = l->next)
293
+ for (l = commit->parents; l; l = l->next) {
294
commit_stack_push(pending, l->item);
295
+ if (revs && revs->exclude_first_parent_only)
296
+ break;
297
+ }
298
}
299
297
-void mark_parents_uninteresting(struct commit *commit)
300
+void mark_parents_uninteresting(struct rev_info *revs, struct commit *commit)
301
{
302
struct commit_stack pending = COMMIT_STACK_INIT;
303
struct commit_list *l;
304
302
- for (l = commit->parents; l; l = l->next)
303
- mark_one_parent_uninteresting(l->item, &pending);
305
+ for (l = commit->parents; l; l = l->next) {
306
+ mark_one_parent_uninteresting(revs, l->item, &pending);
307
+ if (revs && revs->exclude_first_parent_only)
308
+ break;
309
+ }
310
311
while (pending.nr > 0)
306
- mark_one_parent_uninteresting(commit_stack_pop(&pending),
312
+ mark_one_parent_uninteresting(revs, commit_stack_pop(&pending),
313
&pending);
314
315
commit_stack_clear(&pending);
447
if (repo_parse_commit(revs->repo, commit) < 0)
448
die("unable to parse commit %s", name);
449
if (flags & UNINTERESTING) {
444
- mark_parents_uninteresting(commit);
450
+ mark_parents_uninteresting(revs, commit);
451
452
if (!revs->topo_order || !generation_numbers_enabled(the_repository))
453
revs->limited = 1;
1130
if (repo_parse_commit_gently(revs->repo, p, 1) < 0)
1131
continue;
1132
if (p->parents)
1127
- mark_parents_uninteresting(p);
1133
+ mark_parents_uninteresting(revs, p);
1134
if (p->object.flags & SEEN)
1135
continue;
1136
p->object.flags |= (SEEN | NOT_USER_GIVEN);
1138
commit_list_insert_by_date(p, list);
1139
if (queue)
1140
prio_queue_put(queue, p);
1141
+ if (revs->exclude_first_parent_only)
1142
+ break;
1143
}
1144
return 0;
1145
}
1430
if (process_parents(revs, commit, &original_list, NULL) < 0)
1431
return -1;
1432
if (obj->flags & UNINTERESTING) {
1425
- mark_parents_uninteresting(commit);
1433
+ mark_parents_uninteresting(revs, commit);
1434
slop = still_interesting(original_list, date, slop, &interesting_cache);
1435
if (slop)
1436
continue;
2231
return argcount;
2232
} else if (!strcmp(arg, "--first-parent")) {
2233
revs->first_parent_only = 1;
2234
+ } else if (!strcmp(arg, "--exclude-first-parent-only")) {
2235
+ revs->exclude_first_parent_only = 1;
2236
} else if (!strcmp(arg, "--ancestry-path")) {
2237
revs->ancestry_path = 1;
2238
revs->simplify_history = 0;
3355
return;
3356
3357
if (c->object.flags & UNINTERESTING)
3348
- mark_parents_uninteresting(c);
3358
+ mark_parents_uninteresting(revs, c);
3359
3360
for (p = c->parents; p; p = p->next)
3361
test_flag_and_insert(&info->explore_queue, p->item, TOPO_WALK_EXPLORED);