From: Kristofer Karlsson Date: Wed, 04 Nov 2026 17:49:50 GMT Subject: Re: [PATCH 06/10] commit-graph: move remaining write parameters into options Message-ID: In-Reply-To: <20261104-pks-commit-graph-write-refactorings-v1-6-d013d9401a59@pks.im> On Wed, 4 Nov 2026 at 17:15, Patrick Steinhardt wrote: > > if (graph_write_mode != GRAPH_WRITE_TIPS) > write_opts.flags |= COMMIT_GRAPH_WRITE_REACHABLE; > + else > + write_opts.commits = &updated_tips; Ah, this touches on my previous patch cef2d8c4cb (fetch: write commit-graph using updated refs only, 2026-10-07). My only nit would be that the if/else also covers the skip case, so one of the branches always fires for it. A switch would make each mode set exactly what it needs: switch (graph_write_mode) { case GRAPH_WRITE_SKIP: break; case GRAPH_WRITE_REACHABLE: write_opts.flags |= COMMIT_GRAPH_WRITE_REACHABLE; break; case GRAPH_WRITE_TIPS: write_opts.commits = &updated_tips; break; } It doesn't matter for correctness since the skip case never calls the writer, but it looks easier to reason about to me. But that's just a preference, I don't feel strongly about it. > > if (graph_write_mode != GRAPH_WRITE_SKIP) { > trace2_region_enter("fetch", "write-commit-graph", > the_repository); > - if (graph_write_mode == GRAPH_WRITE_TIPS) > - write_commit_graph( > - the_repository, > - the_repository->objects->source->path, > - NULL, &updated_tips, &write_opts); > - else > - write_commit_graph( > - the_repository, > - the_repository->objects->source->path, > - NULL, NULL, &write_opts); > + write_commit_graph(the_repository, > + the_repository->objects->source->path, > + &write_opts); > trace2_region_leave("fetch", "write-commit-graph", > the_repository); > } I really like this unification of the call sites and the patch looks great overall! Thanks, Kristofer