]> git.ipfire.org Git - thirdparty/git.git/commit
promisor-remote: keep accepted promisor_info structs alive
authorChristian Couder <christian.couder@gmail.com>
Tue, 7 Apr 2026 11:52:41 +0000 (13:52 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Apr 2026 15:45:44 +0000 (08:45 -0700)
commite0f80d8876960442dd2645215c4fe5e1b1d80fc3
tree2f624e9131c6cec30da4391e1d4413a40f7b4b19
parent7557a562434804d27f1417fe94c4081e2ee7e68b
promisor-remote: keep accepted promisor_info structs alive

In filter_promisor_remote(), the instances of `struct promisor_info`
for accepted remotes are dismantled into separate parallel data
structures (the 'accepted' strvec for server names, and
'accepted_filters' for filter strings) and then immediately freed.

Instead, let's keep these instances on an 'accepted_remotes' list.

This way the post-loop phase can iterate a single list to build the
protocol reply, apply advertised filters, and mark remotes as
accepted, rather than iterating three separate structures.

This refactoring also prepares for a future commit that will add a
'local_name' member to 'struct promisor_info'. Since struct instances
stay alive, downstream code will be able to simply read both names
from them rather than needing yet another parallel strvec.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
promisor-remote.c