summaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/notes.c b/notes.c
index 03e7d0c..0c79964 100644
--- a/notes.c
+++ b/notes.c
@@ -1043,6 +1043,39 @@ struct notes_tree **load_notes_trees(struct string_list *refs, int flags)
void init_display_notes(struct display_notes_opt *opt)
{
+ memset(opt, 0, sizeof(*opt));
+ opt->use_default_notes = -1;
+}
+
+void enable_default_display_notes(struct display_notes_opt *opt, int *show_notes)
+{
+ opt->use_default_notes = 1;
+ *show_notes = 1;
+}
+
+void enable_ref_display_notes(struct display_notes_opt *opt, int *show_notes,
+ const char *ref) {
+ struct strbuf buf = STRBUF_INIT;
+ strbuf_addstr(&buf, ref);
+ expand_notes_ref(&buf);
+ string_list_append(&opt->extra_notes_refs,
+ strbuf_detach(&buf, NULL));
+ *show_notes = 1;
+}
+
+void disable_display_notes(struct display_notes_opt *opt, int *show_notes)
+{
+ opt->use_default_notes = -1;
+ /* we have been strdup'ing ourselves, so trick
+ * string_list into free()ing strings */
+ opt->extra_notes_refs.strdup_strings = 1;
+ string_list_clear(&opt->extra_notes_refs, 0);
+ opt->extra_notes_refs.strdup_strings = 0;
+ *show_notes = 0;
+}
+
+void load_display_notes(struct display_notes_opt *opt)
+{
char *display_ref_env;
int load_config_refs = 0;
display_notes_refs.strdup_strings = 1;