summaryrefslogtreecommitdiffstats
path: root/log-tree.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2024-10-18 19:56:22 +0200
committerTaylor Blau <me@ttaylorr.com>2024-10-18 19:56:22 +0200
commit6fe1b8cee0c053d8dbfabaaecd6a09adae9f863d (patch)
treec27686e527860e8d61a48dba1a7f429c7b82059c /log-tree.c
parentMerge branch 'kn/loose-object-layer-wo-global-hash' (diff)
parentrebase-merges: try and use branch names as labels (diff)
downloadgit-6fe1b8cee0c053d8dbfabaaecd6a09adae9f863d.tar.xz
git-6fe1b8cee0c053d8dbfabaaecd6a09adae9f863d.zip
Merge branch 'ng/rebase-merges-branch-name-as-label'
"git rebase --rebase-merges" now uses branch names as labels when able. * ng/rebase-merges-branch-name-as-label: rebase-merges: try and use branch names as labels rebase-update-refs: extract load_branch_decorations load_branch_decorations: fix memory leak with non-static filters
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/log-tree.c b/log-tree.c
index ba5632805e..83cc4b1cfb 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -232,6 +232,11 @@ void load_ref_decorations(struct decoration_filter *filter, int flags)
for_each_string_list_item(item, filter->exclude_ref_config_pattern) {
normalize_glob_ref(item, NULL, item->string);
}
+
+ /* normalize_glob_ref duplicates the strings */
+ filter->exclude_ref_pattern->strdup_strings = 1;
+ filter->include_ref_pattern->strdup_strings = 1;
+ filter->exclude_ref_config_pattern->strdup_strings = 1;
}
decoration_loaded = 1;
decoration_flags = flags;
@@ -243,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;