commit-graph.c: simplify 'fill_oids_from_commits'
In the previous handful of commits, both 'git commit-graph write --reachable' and '--stdin-commits' learned to peel tags down to the commits which they refer to before passing them into the commit-graph internals. This makes the call to 'lookup_commit_reference_gently()' inside of 'fill_oids_from_commits()' a noop, since all OIDs are commits by that point. As such, remove the call entirely, as well as the progress meter, which has been split and moved out to the callers in the aforementioned earlier commits. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Taylor Blau committed
May 13, 2020 at 15:59 UTC
0ec2d0ff07f125b7dcf0fde2b508fa8d6d35e939
1 file changed
+3
-30
commit-graph.c
+3
-30
@@ -1412,46 +1412,19 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx,
1412
static int fill_oids_from_commits(struct write_commit_graph_context *ctx,
1413
struct oidset *commits)
1414
{
1415
- uint32_t i = 0;
1416
- struct strbuf progress_title = STRBUF_INIT;
1415
struct oidset_iter iter;
1416
struct object_id *oid;
1417
1418
if (!oidset_size(commits))
1419
return 0;
1420
1423
- if (ctx->report_progress) {
1424
- strbuf_addf(&progress_title,
1425
- Q_("Finding commits for commit graph from %d ref",
1426
- "Finding commits for commit graph from %d refs",
1427
- oidset_size(commits)),
1428
- oidset_size(commits));
1429
- ctx->progress = start_delayed_progress(
1430
- progress_title.buf,
1431
- oidset_size(commits));
1432
- }
1433
-
1421
oidset_iter_init(commits, &iter);
1422
while ((oid = oidset_iter_next(&iter))) {
1436
- struct commit *result;
1437
-
1438
- display_progress(ctx->progress, ++i);
1439
-
1440
- result = lookup_commit_reference_gently(ctx->r, oid, 1);
1441
- if (result) {
1442
- ALLOC_GROW(ctx->oids.list, ctx->oids.nr + 1, ctx->oids.alloc);
1443
- oidcpy(&ctx->oids.list[ctx->oids.nr], &(result->object.oid));
1444
- ctx->oids.nr++;
1445
- } else if (ctx->check_oids) {
1446
- error(_("invalid commit object id: %s"),
1447
- oid_to_hex(oid));
1448
- return -1;
1449
- }
1423
+ ALLOC_GROW(ctx->oids.list, ctx->oids.nr + 1, ctx->oids.alloc);
1424
+ oidcpy(&ctx->oids.list[ctx->oids.nr], oid);
1425
+ ctx->oids.nr++;
1426
}
1427
1452
- stop_progress(&ctx->progress);
1453
- strbuf_release(&progress_title);
1454
-
1428
return 0;
1429
}
1430