diff options
author | Nicolas Guichard <nicolas@guichard.eu> | 2024-10-09 09:58:19 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-10-09 19:52:45 +0200 |
commit | 68c9fcb027b4bd2e5d10618829937ee50503c281 (patch) | |
tree | 0020d08bd3b38f3bbe16ae2e11dc428da06f2f21 /sequencer.c | |
parent | load_branch_decorations: fix memory leak with non-static filters (diff) | |
download | git-68c9fcb027b4bd2e5d10618829937ee50503c281.tar.xz git-68c9fcb027b4bd2e5d10618829937ee50503c281.zip |
rebase-update-refs: extract load_branch_decorations
Extract load_branch_decorations from todo_list_add_update_ref_commands so
it can be re-used in make_script_with_merges.
Since it can now be called multiple times, use non-static lists and place
it next to load_ref_decorations to re-use the decoration_loaded guard.
Signed-off-by: Nicolas Guichard <nicolas@guichard.eu>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/sequencer.c b/sequencer.c index 8d01cd50ac..97959036b5 100644 --- a/sequencer.c +++ b/sequencer.c @@ -6403,14 +6403,6 @@ static int add_decorations_to_list(const struct commit *commit, static int todo_list_add_update_ref_commands(struct todo_list *todo_list) { int i, res; - static struct string_list decorate_refs_exclude = STRING_LIST_INIT_NODUP; - static struct string_list decorate_refs_exclude_config = STRING_LIST_INIT_NODUP; - static struct string_list decorate_refs_include = STRING_LIST_INIT_NODUP; - struct decoration_filter decoration_filter = { - .include_ref_pattern = &decorate_refs_include, - .exclude_ref_pattern = &decorate_refs_exclude, - .exclude_ref_config_pattern = &decorate_refs_exclude_config, - }; struct todo_add_branch_context ctx = { .buf = &todo_list->buf, .refs_to_oids = STRING_LIST_INIT_DUP, @@ -6419,8 +6411,7 @@ static int todo_list_add_update_ref_commands(struct todo_list *todo_list) ctx.items_alloc = 2 * todo_list->nr + 1; ALLOC_ARRAY(ctx.items, ctx.items_alloc); - string_list_append(&decorate_refs_include, "refs/heads/"); - load_ref_decorations(&decoration_filter, 0); + load_branch_decorations(); for (i = 0; i < todo_list->nr; ) { struct todo_item *item = &todo_list->items[i]; |