From 1e6ed5441a61b5085978e0429691e2e2425f6846 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Mon, 9 Dec 2019 05:10:39 -0800 Subject: [PATCH 1/8] notes: rename to load_display_notes() According to the function comment, init_display_notes() was supposed to "Load the notes machinery for displaying several notes trees." Rename this function to load_display_notes() so that its use is more accurately represented. This is done because, in a future commit, we will reuse the name init_display_notes(). Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- builtin/log.c | 4 ++-- notes.c | 2 +- notes.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index dad63cffc63..622d6a6cb16 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -202,7 +202,7 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, if (!rev->show_notes_given && (!rev->pretty_given || w.notes)) rev->show_notes = 1; if (rev->show_notes) - init_display_notes(&rev->notes_opt); + load_display_notes(&rev->notes_opt); if ((rev->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) || rev->diffopt.filter || rev->diffopt.flags.follow_renames) @@ -1749,7 +1749,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) rev.diffopt.flags.binary = 1; if (rev.show_notes) - init_display_notes(&rev.notes_opt); + load_display_notes(&rev.notes_opt); if (!output_directory && !use_stdout) output_directory = config_output_directory; diff --git a/notes.c b/notes.c index 532ec378657..fd6cef14a3b 100644 --- a/notes.c +++ b/notes.c @@ -1039,7 +1039,7 @@ struct notes_tree **load_notes_trees(struct string_list *refs, int flags) return trees; } -void init_display_notes(struct display_notes_opt *opt) +void load_display_notes(struct display_notes_opt *opt) { char *display_ref_env; int load_config_refs = 0; diff --git a/notes.h b/notes.h index 414bc6855ad..1ce528442a5 100644 --- a/notes.h +++ b/notes.h @@ -272,18 +272,18 @@ struct display_notes_opt { * - extra_notes_refs may contain a list of globs (in the same style * as notes.displayRef) where notes should be loaded from. */ -void init_display_notes(struct display_notes_opt *opt); +void load_display_notes(struct display_notes_opt *opt); /* * Append notes for the given 'object_sha1' from all trees set up by - * init_display_notes() to 'sb'. The 'flags' are a bitwise + * load_display_notes() to 'sb'. The 'flags' are a bitwise * combination of * * - NOTES_SHOW_HEADER: add a 'Notes (refname):' header * * - NOTES_INDENT: indent the notes by 4 places * - * You *must* call init_display_notes() before using this function. + * You *must* call load_display_notes() before using this function. */ void format_display_notes(const struct object_id *object_oid, struct strbuf *sb, const char *output_encoding, int raw); From e6e230eeae0f3cb46c4c356e6cd0a0f1119a2a83 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Mon, 9 Dec 2019 05:10:41 -0800 Subject: [PATCH 2/8] 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 Signed-off-by: Junio C Hamano --- notes.c | 6 ++++++ notes.h | 5 +++++ revision.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/notes.c b/notes.c index fd6cef14a3b..53d1e7767ce 100644 --- a/notes.c +++ b/notes.c @@ -1039,6 +1039,12 @@ struct notes_tree **load_notes_trees(struct string_list *refs, int flags) 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) { char *display_ref_env; diff --git a/notes.h b/notes.h index 1ce528442a5..c0b712371cc 100644 --- a/notes.h +++ b/notes.h @@ -260,6 +260,11 @@ struct display_notes_opt { 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. * diff --git a/revision.c b/revision.c index d4aaf0ef257..24ad974590b 100644 --- a/revision.c +++ b/revision.c @@ -1637,7 +1637,7 @@ void repo_init_revisions(struct repository *r, 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, From 452538c3586a76939faf43019fb7c21b3147309b Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Mon, 9 Dec 2019 05:10:44 -0800 Subject: [PATCH 3/8] notes: extract logic into set_display_notes() Instead of open coding the logic that tweaks the variables in `struct display_notes_opt` within handle_revision_opt(), abstract away the logic into set_display_notes() so that it can be reused. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- notes.c | 24 ++++++++++++++++++++++++ notes.h | 10 ++++++++++ revision.c | 22 +++++----------------- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/notes.c b/notes.c index 53d1e7767ce..c93feff4abd 100644 --- a/notes.c +++ b/notes.c @@ -1045,6 +1045,30 @@ void init_display_notes(struct display_notes_opt *opt) opt->use_default_notes = -1; } +int set_display_notes(struct display_notes_opt *opt, int show_notes, const char *opt_ref) +{ + if (show_notes) { + if (opt_ref) { + struct strbuf buf = STRBUF_INIT; + strbuf_addstr(&buf, opt_ref); + expand_notes_ref(&buf); + string_list_append(&opt->extra_notes_refs, + strbuf_detach(&buf, NULL)); + } else { + opt->use_default_notes = 1; + } + } else { + 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; + } + + return !!show_notes; +} + void load_display_notes(struct display_notes_opt *opt) { char *display_ref_env; diff --git a/notes.h b/notes.h index c0b712371cc..a476bfa0665 100644 --- a/notes.h +++ b/notes.h @@ -265,6 +265,16 @@ struct display_notes_opt { */ void init_display_notes(struct display_notes_opt *opt); +/* + * Set a display_notes_opt to a given state. 'show_notes' is a boolean + * representing whether or not to show notes. 'opt_ref' points to a + * string for the notes ref, or is NULL if the default notes should be + * used. + * + * Return 'show_notes' normalized to 1 or 0. + */ +int set_display_notes(struct display_notes_opt *opt, int show_notes, const char *opt_ref); + /* * Load the notes machinery for displaying several notes trees. * diff --git a/revision.c b/revision.c index 24ad974590b..c2d8d24939d 100644 --- a/revision.c +++ b/revision.c @@ -2172,9 +2172,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg die("'%s': not a non-negative integer", arg); revs->expand_tabs_in_log = val; } else if (!strcmp(arg, "--show-notes") || !strcmp(arg, "--notes")) { - revs->show_notes = 1; + revs->show_notes = set_display_notes(&revs->notes_opt, 1, NULL); revs->show_notes_given = 1; - revs->notes_opt.use_default_notes = 1; } else if (!strcmp(arg, "--show-signature")) { revs->show_signature = 1; } else if (!strcmp(arg, "--no-show-signature")) { @@ -2189,25 +2188,14 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs->track_first_time = 1; } else if (skip_prefix(arg, "--show-notes=", &optarg) || skip_prefix(arg, "--notes=", &optarg)) { - struct strbuf buf = STRBUF_INIT; - revs->show_notes = 1; - revs->show_notes_given = 1; if (starts_with(arg, "--show-notes=") && revs->notes_opt.use_default_notes < 0) revs->notes_opt.use_default_notes = 1; - strbuf_addstr(&buf, optarg); - expand_notes_ref(&buf); - string_list_append(&revs->notes_opt.extra_notes_refs, - strbuf_detach(&buf, NULL)); - } else if (!strcmp(arg, "--no-notes")) { - revs->show_notes = 0; + revs->show_notes = set_display_notes(&revs->notes_opt, 1, optarg); + revs->show_notes_given = 1; + } else if (!strcmp(arg, "--no-notes")) { + revs->show_notes = set_display_notes(&revs->notes_opt, 0, NULL); revs->show_notes_given = 1; - revs->notes_opt.use_default_notes = -1; - /* we have been strdup'ing ourselves, so trick - * string_list into free()ing strings */ - revs->notes_opt.extra_notes_refs.strdup_strings = 1; - string_list_clear(&revs->notes_opt.extra_notes_refs, 0); - revs->notes_opt.extra_notes_refs.strdup_strings = 0; } else if (!strcmp(arg, "--standard-notes")) { revs->show_notes_given = 1; revs->notes_opt.use_default_notes = 1; From 8164c961e16834da283cbf5ac5d22313b982a484 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Mon, 9 Dec 2019 05:10:46 -0800 Subject: [PATCH 4/8] format-patch: use --notes behavior for format.notes When we had multiple `format.notes` config values where we had ``, `false`, `` (in that order), then we would print out the notes for both `` and ``. This doesn't make sense, however, since we parse the config in a top-down manner and a `false` should be able to override previous configurations, just like how `--no-notes` will override previous `--notes`. Duplicate the logic that handles the `--[no-]notes[=]` option to `format.notes` for consistency. As a result, when parsing the config from top to bottom, `format.notes = true` will behave like `--notes`, `format.notes = ` will behave like `--notes=` and `format.notes = false` will behave like `--no-notes`. This change isn't strictly backwards compatible but since it is an edge case where a sane user would not mix notes refs with `false` and this feature is relatively new (released only in v2.23.0), this change should be harmless. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- builtin/log.c | 13 +------------ t/t4014-format-patch.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index 622d6a6cb16..1f0405f72be 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -867,19 +867,8 @@ static int git_format_config(const char *var, const char *value, void *cb) return 0; } if (!strcmp(var, "format.notes")) { - struct strbuf buf = STRBUF_INIT; int b = git_parse_maybe_bool(value); - if (!b) - return 0; - rev->show_notes = 1; - if (b < 0) { - strbuf_addstr(&buf, value); - expand_notes_ref(&buf); - string_list_append(&rev->notes_opt.extra_notes_refs, - strbuf_detach(&buf, NULL)); - } else { - rev->notes_opt.use_default_notes = 1; - } + rev->show_notes = set_display_notes(&rev->notes_opt, b, b < 0 ? value : NULL); return 0; } diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 4d5719fe2c1..5c40ea43976 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -808,6 +808,38 @@ test_expect_success 'format-patch with multiple notes refs' ' ! grep "this is note 2" out ' +test_expect_success 'format-patch with multiple notes refs in config' ' + test_when_finished "test_unconfig format.notes" && + + git notes --ref note1 add -m "this is note 1" HEAD && + test_when_finished git notes --ref note1 remove HEAD && + git notes --ref note2 add -m "this is note 2" HEAD && + test_when_finished git notes --ref note2 remove HEAD && + + git config format.notes note1 && + git format-patch -1 --stdout >out && + grep "this is note 1" out && + ! grep "this is note 2" out && + git config format.notes note2 && + git format-patch -1 --stdout >out && + ! grep "this is note 1" out && + grep "this is note 2" out && + git config --add format.notes note1 && + git format-patch -1 --stdout >out && + grep "this is note 1" out && + grep "this is note 2" out && + + git config --replace-all format.notes note1 && + git config --add format.notes false && + git format-patch -1 --stdout >out && + ! grep "this is note 1" out && + ! grep "this is note 2" out && + git config --add format.notes note2 && + git format-patch -1 --stdout >out && + ! grep "this is note 1" out && + grep "this is note 2" out +' + echo "fatal: --name-only does not make sense" > expect.name-only echo "fatal: --name-status does not make sense" > expect.name-status echo "fatal: --check does not make sense" > expect.check From 09ac67a1839eda984b172d4d75153c767d6bbf14 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Mon, 9 Dec 2019 05:10:48 -0800 Subject: [PATCH 5/8] format-patch: move git_config() before repo_init_revisions() In 13cdf78094 (format-patch: teach format.notes config option, 2019-05-16), the order in which git_config() and repo_init_revisions() were swapped so that `rev.notes_opt` would be initialized before git_config() was called. This is problematic, however, as git_config() should generally be called before repo_init_revisions(). Break this circular dependency by creating `show_notes` and `notes_opt` which git_config() reads into. Then, copy these values over to `rev.show_notes` and `rev.notes_opt` after repo_init_revisions() is called. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- builtin/log.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index 1f0405f72be..4225615e7fc 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -769,6 +769,8 @@ static const char *signature = git_version_string; static const char *signature_file; static int config_cover_letter; static const char *config_output_directory; +static int show_notes; +static struct display_notes_opt notes_opt; enum { COVER_UNSET, @@ -779,8 +781,6 @@ enum { static int git_format_config(const char *var, const char *value, void *cb) { - struct rev_info *rev = cb; - if (!strcmp(var, "format.headers")) { if (!value) die(_("format.headers without value")); @@ -868,7 +868,7 @@ static int git_format_config(const char *var, const char *value, void *cb) } if (!strcmp(var, "format.notes")) { int b = git_parse_maybe_bool(value); - rev->show_notes = set_display_notes(&rev->notes_opt, b, b < 0 ? value : NULL); + show_notes = set_display_notes(¬es_opt, b, b < 0 ? value : NULL); return 0; } @@ -1624,8 +1624,11 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) extra_to.strdup_strings = 1; extra_cc.strdup_strings = 1; init_log_defaults(); + init_display_notes(¬es_opt); + git_config(git_format_config, NULL); repo_init_revisions(the_repository, &rev, prefix); - git_config(git_format_config, &rev); + rev.show_notes = show_notes; + memcpy(&rev.notes_opt, ¬es_opt, sizeof(notes_opt)); rev.commit_format = CMIT_FMT_EMAIL; rev.expand_tabs_in_log_default = 0; rev.verbose_header = 1; From 66f79ee23d51ac11784aeb0ef4f4119af9fbb984 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Wed, 11 Dec 2019 16:49:47 -0800 Subject: [PATCH 6/8] config/format.txt: clarify behavior of multiple format.notes In 8164c961e1 (format-patch: use --notes behavior for format.notes, 2019-12-09), we slightly tweaked the behavior of having multiple `format.notes` configuration variables. We did not update the documentation to reflect this, however. Explictly state the behavior of having multiple `format.notes` configuration variables so users are clear on what to expect. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- Documentation/config/format.txt | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Documentation/config/format.txt b/Documentation/config/format.txt index 414a5a8a9d7..3d708b0aecf 100644 --- a/Documentation/config/format.txt +++ b/Documentation/config/format.txt @@ -99,4 +99,20 @@ If one wishes to use the ref `ref/notes/true`, please use that literal instead. + This configuration can be specified multiple times in order to allow -multiple notes refs to be included. +multiple notes refs to be included. In that case, it will behave +similarly to multiple `--[no-]notes[=]` options passed in. That is, a +value of `true` will show the default notes, a value of `` will +also show notes from that notes ref and a value of `false` will negate +previous configurations and not show notes. ++ +For example, ++ +------------ +[format] + notes = true + notes = foo + notes = false + notes = bar +------------ ++ +will only show notes from `refs/notes/bar`. From 1d7297513df66873e68af4b254804151b8ba5359 Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Wed, 11 Dec 2019 16:49:50 -0800 Subject: [PATCH 7/8] notes: break set_display_notes() into smaller functions In 8164c961e1 (format-patch: use --notes behavior for format.notes, 2019-12-09), we introduced set_display_notes() which was a monolithic function with three mutually exclusive branches. Break the function up into three small and simple functions that each are only responsible for one task. This family of functions accepts an `int *show_notes` instead of returning a value suitable for assignment to `show_notes`. This is for two reasons. First of all, this guarantees that the external `show_notes` variable changes in lockstep with the `struct display_notes_opt`. Second, this prompts future developers to be careful about doing something meaningful with this value. In fact, a NULL check is intentionally omitted because causing a segfault here would tell the future developer that they are meant to use the value for something meaningful. One alternative was making the family of functions accept a `struct rev_info *` instead of the `struct display_notes_opt *`, since the former contains the `show_notes` field as well. This does not work because we have to call git_config() before repo_init_revisions(). However, if we had a `struct rev_info`, we'd need to initialize it before it gets assigned values from git_config(). As a result, we break the circular dependency by having standalone `int show_notes` and `struct display_notes_opt notes_opt` variables which temporarily hold values from git_config() until the values are copied over to `rev`. To implement this change, we need to get a pointer to `rev_info::show_notes`. Unfortunately, this is not possible with bitfields and only direct-assignment is possible. Change `rev_info::show_notes` to a non-bitfield int so that we can get its address. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- builtin/log.c | 7 ++++++- notes.c | 43 +++++++++++++++++++++++-------------------- notes.h | 17 +++++++++++------ revision.c | 6 +++--- revision.h | 2 +- 5 files changed, 44 insertions(+), 31 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index 4225615e7fc..b6d43a4a47e 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -868,7 +868,12 @@ static int git_format_config(const char *var, const char *value, void *cb) } if (!strcmp(var, "format.notes")) { int b = git_parse_maybe_bool(value); - show_notes = set_display_notes(¬es_opt, b, b < 0 ? value : NULL); + if (b < 0) + enable_ref_display_notes(¬es_opt, &show_notes, value); + else if (b) + enable_default_display_notes(¬es_opt, &show_notes); + else + disable_display_notes(¬es_opt, &show_notes); return 0; } diff --git a/notes.c b/notes.c index c93feff4abd..3133bb181fa 100644 --- a/notes.c +++ b/notes.c @@ -1045,28 +1045,31 @@ void init_display_notes(struct display_notes_opt *opt) opt->use_default_notes = -1; } -int set_display_notes(struct display_notes_opt *opt, int show_notes, const char *opt_ref) +void enable_default_display_notes(struct display_notes_opt *opt, int *show_notes) { - if (show_notes) { - if (opt_ref) { - struct strbuf buf = STRBUF_INIT; - strbuf_addstr(&buf, opt_ref); - expand_notes_ref(&buf); - string_list_append(&opt->extra_notes_refs, - strbuf_detach(&buf, NULL)); - } else { - opt->use_default_notes = 1; - } - } else { - 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; - } + opt->use_default_notes = 1; + *show_notes = 1; +} - return !!show_notes; +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) diff --git a/notes.h b/notes.h index a476bfa0665..3e784481815 100644 --- a/notes.h +++ b/notes.h @@ -266,14 +266,19 @@ struct display_notes_opt { void init_display_notes(struct display_notes_opt *opt); /* - * Set a display_notes_opt to a given state. 'show_notes' is a boolean - * representing whether or not to show notes. 'opt_ref' points to a - * string for the notes ref, or is NULL if the default notes should be - * used. + * This family of functions enables or disables the display of notes. In + * particular, 'enable_default_display_notes' will display the default notes, + * 'enable_default_display_notes' will display the notes ref 'ref' and + * 'disable_display_notes' will disable notes, including those added by previous + * invocations of the 'enable_*_display_notes' functions. * - * Return 'show_notes' normalized to 1 or 0. + * 'show_notes' is a points to a boolean which will be set to 1 if notes are + * displayed, else 0. It must not be NULL. */ -int set_display_notes(struct display_notes_opt *opt, int show_notes, const char *opt_ref); +void enable_default_display_notes(struct display_notes_opt *opt, int *show_notes); +void enable_ref_display_notes(struct display_notes_opt *opt, int *show_notes, + const char *ref); +void disable_display_notes(struct display_notes_opt *opt, int *show_notes); /* * Load the notes machinery for displaying several notes trees. diff --git a/revision.c b/revision.c index c2d8d24939d..1b12ed742bf 100644 --- a/revision.c +++ b/revision.c @@ -2172,7 +2172,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg die("'%s': not a non-negative integer", arg); revs->expand_tabs_in_log = val; } else if (!strcmp(arg, "--show-notes") || !strcmp(arg, "--notes")) { - revs->show_notes = set_display_notes(&revs->notes_opt, 1, NULL); + enable_default_display_notes(&revs->notes_opt, &revs->show_notes); revs->show_notes_given = 1; } else if (!strcmp(arg, "--show-signature")) { revs->show_signature = 1; @@ -2191,10 +2191,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg if (starts_with(arg, "--show-notes=") && revs->notes_opt.use_default_notes < 0) revs->notes_opt.use_default_notes = 1; - revs->show_notes = set_display_notes(&revs->notes_opt, 1, optarg); + enable_ref_display_notes(&revs->notes_opt, &revs->show_notes, optarg); revs->show_notes_given = 1; } else if (!strcmp(arg, "--no-notes")) { - revs->show_notes = set_display_notes(&revs->notes_opt, 0, NULL); + disable_display_notes(&revs->notes_opt, &revs->show_notes); revs->show_notes_given = 1; } else if (!strcmp(arg, "--standard-notes")) { revs->show_notes_given = 1; diff --git a/revision.h b/revision.h index 4134dc6029c..72520780f45 100644 --- a/revision.h +++ b/revision.h @@ -177,10 +177,10 @@ struct rev_info { always_show_header:1; /* Format info */ + int show_notes; unsigned int shown_one:1, shown_dashes:1, show_merge:1, - show_notes:1, show_notes_given:1, show_signature:1, pretty_given:1, From e0f9095aaa56f5c731faced2e61ca48df5caedfb Mon Sep 17 00:00:00 2001 From: Denton Liu Date: Wed, 18 Dec 2019 10:17:43 -0800 Subject: [PATCH 8/8] notes.h: fix typos in comment In 1d7297513d (notes: break set_display_notes() into smaller functions, 2019-12-11), we introduced a comment which had a couple of typos. In the first typo, we referenced 'enable_default_display_notes' instead of 'enable_ref_display_notes'. In the second typo, we wrote "is a points to" instead of "is a pointer to". Correct both of these typos. Reported-by: Eric Sunshine Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- notes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notes.h b/notes.h index 3e784481815..bbab1961caf 100644 --- a/notes.h +++ b/notes.h @@ -268,11 +268,11 @@ void init_display_notes(struct display_notes_opt *opt); /* * This family of functions enables or disables the display of notes. In * particular, 'enable_default_display_notes' will display the default notes, - * 'enable_default_display_notes' will display the notes ref 'ref' and + * 'enable_ref_display_notes' will display the notes ref 'ref' and * 'disable_display_notes' will disable notes, including those added by previous * invocations of the 'enable_*_display_notes' functions. * - * 'show_notes' is a points to a boolean which will be set to 1 if notes are + * 'show_notes' is a pointer to a boolean which will be set to 1 if notes are * displayed, else 0. It must not be NULL. */ void enable_default_display_notes(struct display_notes_opt *opt, int *show_notes);