notes: create init_display_notes() helper
We currently open code the initialization for revs->notes_opt. Abstract this away into a helper function so that the logic can be reused in a future commit. This is slightly wasteful as we memset the struct twice but this is only run once so it shouldn't have any major effect. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
1e6ed5441a
commit
e6e230eeae
6
notes.c
6
notes.c
|
@ -1039,6 +1039,12 @@ struct notes_tree **load_notes_trees(struct string_list *refs, int flags)
|
||||||
return trees;
|
return trees;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_display_notes(struct display_notes_opt *opt)
|
||||||
|
{
|
||||||
|
memset(opt, 0, sizeof(*opt));
|
||||||
|
opt->use_default_notes = -1;
|
||||||
|
}
|
||||||
|
|
||||||
void load_display_notes(struct display_notes_opt *opt)
|
void load_display_notes(struct display_notes_opt *opt)
|
||||||
{
|
{
|
||||||
char *display_ref_env;
|
char *display_ref_env;
|
||||||
|
|
5
notes.h
5
notes.h
|
@ -260,6 +260,11 @@ struct display_notes_opt {
|
||||||
struct string_list extra_notes_refs;
|
struct string_list extra_notes_refs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize a display_notes_opt to its default value.
|
||||||
|
*/
|
||||||
|
void init_display_notes(struct display_notes_opt *opt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load the notes machinery for displaying several notes trees.
|
* Load the notes machinery for displaying several notes trees.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1637,7 +1637,7 @@ void repo_init_revisions(struct repository *r,
|
||||||
revs->diffopt.prefix_length = strlen(prefix);
|
revs->diffopt.prefix_length = strlen(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
revs->notes_opt.use_default_notes = -1;
|
init_display_notes(&revs->notes_opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_pending_commit_list(struct rev_info *revs,
|
static void add_pending_commit_list(struct rev_info *revs,
|
||||||
|
|
Loading…
Reference in New Issue