summaryrefslogtreecommitdiffstats
path: root/log-tree.c
diff options
context:
space:
mode:
authorNicolas Guichard <nicolas@guichard.eu>2024-10-09 09:58:19 +0200
committerJunio C Hamano <gitster@pobox.com>2024-10-09 19:52:45 +0200
commit68c9fcb027b4bd2e5d10618829937ee50503c281 (patch)
tree0020d08bd3b38f3bbe16ae2e11dc428da06f2f21 /log-tree.c
parentload_branch_decorations: fix memory leak with non-static filters (diff)
downloadgit-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 'log-tree.c')
-rw-r--r--log-tree.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/log-tree.c b/log-tree.c
index c65ebd2920..bf6d2ae40c 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -248,6 +248,27 @@ void load_ref_decorations(struct decoration_filter *filter, int flags)
}
}
+void load_branch_decorations(void)
+{
+ if (!decoration_loaded) {
+ struct string_list decorate_refs_exclude = STRING_LIST_INIT_NODUP;
+ struct string_list decorate_refs_exclude_config = STRING_LIST_INIT_NODUP;
+ 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,
+ };
+
+ string_list_append(&decorate_refs_include, "refs/heads/");
+ load_ref_decorations(&decoration_filter, 0);
+
+ string_list_clear(&decorate_refs_exclude, 0);
+ string_list_clear(&decorate_refs_exclude_config, 0);
+ string_list_clear(&decorate_refs_include, 0);
+ }
+}
+
static void show_parents(struct commit *commit, int abbrev, FILE *file)
{
struct commit_list *p;