Merge branch 'dl/format-patch-notes-config-fixup'
"git format-patch" can take a set of configured format.notes values to specify which notes refs to use in the log message part of the output. The behaviour of this was not consistent with multiple --notes command line options, which has been corrected. * dl/format-patch-notes-config-fixup: notes.h: fix typos in comment notes: break set_display_notes() into smaller functions config/format.txt: clarify behavior of multiple format.notes format-patch: move git_config() before repo_init_revisions() format-patch: use --notes behavior for format.notes notes: extract logic into set_display_notes() notes: create init_display_notes() helper notes: rename to load_display_notes()
This commit is contained in:
33
notes.c
33
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;
|
||||
|
||||
Reference in New Issue
Block a user