]> git.ipfire.org Git - thirdparty/git.git/blobdiff - notes.c
Sync with maint
[thirdparty/git.git] / notes.c
diff --git a/notes.c b/notes.c
index 03e7d0cd2ddaf623fd41d4969348c624beee56d5..0c79964c26a71d6843c43c94fe260131334749f2 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -1042,6 +1042,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;