All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denton Liu <liu.denton@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>, Beat Bolli <dev+git@drbeat.li>
Subject: [PATCH v4 0/2] format-patch: teach format.notes config option
Date: Thu, 16 May 2019 19:13:44 -0400	[thread overview]
Message-ID: <cover.1558048212.git.liu.denton@gmail.com> (raw)

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


             reply	other threads:[~2019-05-16 23:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 23:13 Denton Liu [this message]
2019-05-16 23:13 ` [PATCH v4 1/2] git-format-patch.txt: document --no-notes option Denton Liu
2019-05-16 23:14 ` [PATCH v4 2/2] format-patch: teach format.notes config option Denton Liu
2019-12-08  7:48   ` Elijah Newren
2019-12-09  8:24     ` Denton Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1558048212.git.liu.denton@gmail.com \
    --to=liu.denton@gmail.com \
    --cc=dev+git@drbeat.li \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.