Web lists-archives.com

[PATCH v4 0/2] format-patch: teach format.notes config option




Hi Junio,

I've changed format.notes so that it can accept a boolean as well.
Hopefully, my last email has addressed the remainder of your comments.

Changes since v3:

* Made format.notes accept a boolean instead of "standard" to get
  default notes

Changes since v2:

* Fixed if-else code style
* Fixed typoed errors in 2/2 log message

Changes since v1:

* Made format.notes accept a notes ref instead of a boolean


Denton Liu (2):
  git-format-patch.txt: document --no-notes option
  format-patch: teach format.notes config option

 Documentation/config/format.txt    | 15 +++++++
 Documentation/git-format-patch.txt |  7 ++-
 builtin/log.c                      | 20 ++++++++-
 t/t4014-format-patch.sh            | 70 ++++++++++++++++++++++++++++++
 4 files changed, 110 insertions(+), 2 deletions(-)

Range-diff against v3:
1:  4c3535f25b = 1:  4c3535f25b git-format-patch.txt: document --no-notes option
2:  df864c4adf ! 2:  7cb770e190 format-patch: teach format.notes config option
    @@ -25,14 +25,16 @@
      	format-patch by default.
     +
     +format.notes::
    -+	A ref which specifies where to get the notes (see
    -+	linkgit:git-notes[1]) that are appended for the commit after the
    -+	three-dash line.
    ++	Provides the default value for the `--notes` option to
    ++	format-patch. Accepts a boolean value, or a ref which specifies
    ++	where to get notes. If false, format-patch defaults to
    ++	`--no-notes`. If true, format-patch defaults to `--notes`. If
    ++	set to a non-boolean value, format-patch defaults to
    ++	`--notes=<ref>`, where `ref` is the non-boolean value. Defaults
    ++	to false.
     ++
    -+If the special value of "standard" is specified, then the standard notes
    -+ref is used (i.e. the notes ref used by `git notes` when no `--ref`
    -+argument is specified). If one wishes to use the ref
    -+`ref/notes/standard`, please use that literal instead.
    ++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.
    @@ -69,15 +71,17 @@
      	}
     +	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 (!strcmp(value, "standard")) {
    -+			rev->notes_opt.use_default_notes = 1;
    -+		} else {
    ++		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;
     +		}
     +		return 0;
     +	}
    @@ -117,7 +121,7 @@
     +	git format-patch -1 --stdout --no-notes --notes >out &&
     +	grep "notes config message" out &&
     +
    -+	test_config format.notes standard &&
    ++	test_config format.notes true &&
     +	git format-patch -1 --stdout >out &&
     +	grep "notes config message" out &&
     +	git format-patch -1 --stdout --notes >out &&
-- 
2.21.0.1049.geb646f7864