Skip to content

Commit 0ec2d0f

Browse files
ttaylorrgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5b6653e commit 0ec2d0f

File tree

1 file changed

+3
-30
lines changed

1 file changed

+3
-30
lines changed

commit-graph.c

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,46 +1412,19 @@ static int fill_oids_from_packs(struct write_commit_graph_context *ctx,
14121412
static int fill_oids_from_commits(struct write_commit_graph_context *ctx,
14131413
struct oidset *commits)
14141414
{
1415-
uint32_t i = 0;
1416-
struct strbuf progress_title = STRBUF_INIT;
14171415
struct oidset_iter iter;
14181416
struct object_id *oid;
14191417

14201418
if (!oidset_size(commits))
14211419
return 0;
14221420

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-
14341421
oidset_iter_init(commits, &iter);
14351422
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++;
14501426
}
14511427

1452-
stop_progress(&ctx->progress);
1453-
strbuf_release(&progress_title);
1454-
14551428
return 0;
14561429
}
14571430

0 commit comments

Comments
 (0)