commit-graph: use progress title directly
merge_commit_graphs() copies the (translated) progress message into a strbuf and passes the copy to start_delayed_progress() at each loop iteration. The latter function takes a string pointer, so let's avoid the detour and hand the string to it directly. That's shorter, simpler and slightly more efficient. Signed-off-by: René Scharfe <l.s.r@web.de> Acked-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Feb 20, 2020 at 19:49 UTC
d68ce906c7e1b2bb28a389b915cb63ddbae43365
1 file changed
+2
-6
commit-graph.c
+2
-6
@@ -1590,19 +1590,15 @@ static void merge_commit_graphs(struct write_commit_graph_context *ctx)
1590
{
1591
struct commit_graph *g = ctx->r->objects->commit_graph;
1592
uint32_t current_graph_number = ctx->num_commit_graphs_before;
1593
- struct strbuf progress_title = STRBUF_INIT;
1593
1594
while (g && current_graph_number >= ctx->num_commit_graphs_after) {
1595
current_graph_number--;
1596
1598
- if (ctx->report_progress) {
1599
- strbuf_addstr(&progress_title, _("Merging commit-graph"));
1600
- ctx->progress = start_delayed_progress(progress_title.buf, 0);
1601
- }
1597
+ if (ctx->report_progress)
1598
+ ctx->progress = start_delayed_progress(_("Merging commit-graph"), 0);
1599
1600
merge_commit_graph(ctx, g);
1601
stop_progress(&ctx->progress);
1605
- strbuf_release(&progress_title);
1602
1603
g = g->base_graph;
1604
}