git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 7, 2019, 04:43 UTC
Message-ID
<xmqqlfzinab4.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<1338045be4a185cddc3ebf8adbe4b744551acf15.1556388260.git.liu.denton@gmail.com>
Denton Liu <liu.denton@gmail.com> writes:
Show 31 quoted lines
> In git-format-patch, notes can be appended with the `--notes` option.
> However, this must be specified by the user on an
> invocation-by-invocation basis. If a user is not careful, it's possible
> that they may forget to include it and generate a patch series without
> notes.
>
> Teach git-format-patch the `format.notes` config option where if its
> value is true, notes will automatically be appended. This option is
> overridable with the `--no-notes` option in case a user wishes not to
> append notes.
>
> Signed-off-by: Denton Liu <liu.denton@gmail.com>
> ---
>  Documentation/config/format.txt    |  4 ++++
>  Documentation/git-format-patch.txt |  3 +++
>  builtin/log.c                      |  6 ++++++
>  t/t4014-format-patch.sh            | 28 ++++++++++++++++++++++++++++
>  4 files changed, 41 insertions(+)
>
> diff --git a/Documentation/config/format.txt b/Documentation/config/format.txt
> index dc77941c48..55327b6511 100644
> --- a/Documentation/config/format.txt
> +++ b/Documentation/config/format.txt
> @@ -85,3 +85,7 @@ format.outputDirectory::
>  format.useAutoBase::
>  	A boolean value which lets you enable the `--base=auto` option of
>  	format-patch by default.
> +
> +format.notes::
> +	A boolean value which lets you enable the `--notes` option of
> +	format-patch by default.
Whoa.  Why should this be a boolean?
I think I can do
	git format-patch --notes=amlog master..

and was hoping that this can be used to configure the option out of my command line typing.

Show 7 quoted lines
> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
> index b6e2fdbc44..fe9522121a 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -738,6 +738,34 @@ test_expect_success 'format-patch --notes --signoff' '
>  	sed "1,/^---$/d" out | grep "test message"
>  '

And if you look at the existing test above this, you'd notice that the command is tested is in "format-patch --notes=test" form. We should make sure that the same is done with the config in the new test, too.

Show 31 quoted lines
> +test_expect_success 'format-patch notes output control' '
> +	git notes add -m "notes config message" HEAD &&
> +	test_when_finished git notes remove HEAD &&
> +
> +	git format-patch -1 --stdout >out &&
> +	! grep "notes config message" out &&
> +	git format-patch -1 --stdout --notes >out &&
> +	grep "notes config message" out &&
> +	git format-patch -1 --stdout --no-notes >out &&
> +	! grep "notes config message" out &&
> +	git format-patch -1 --stdout --notes --no-notes >out &&
> +	! grep "notes config message" out &&
> +	git format-patch -1 --stdout --no-notes --notes >out &&
> +	grep "notes config message" out &&
> +
> +	test_config format.notes true &&
> +	git format-patch -1 --stdout >out &&
> +	grep "notes config message" out &&
> +	git format-patch -1 --stdout --notes >out &&
> +	grep "notes config message" out &&
> +	git format-patch -1 --stdout --no-notes >out &&
> +	! grep "notes config message" out &&
> +	git format-patch -1 --stdout --notes --no-notes >out &&
> +	! grep "notes config message" out &&
> +	git format-patch -1 --stdout --no-notes --notes >out &&
> +	grep "notes config message" 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
Previous: Denton LiuNext: Denton Liu
Message 4 of 15 in “format-patch: teach format.notes config option”
  1. 0/2 format-patch: teach format.notes config optionDenton Liu, Apr 27, 2019
  2. 1/2 git-format-patch.txt: document --no-notes optionDenton Liu, Apr 27, 2019
  3. 2/2 format-patch: teach format.notes config optionDenton Liu, Apr 27, 2019
  4. Junio C HamanoMay 7, 2019
  5. 0/2 format-patch: teach format.notes config optionDenton Liu, May 8, 2019
  6. 1/2 git-format-patch.txt: document --no-notes optionDenton Liu, May 8, 2019
  7. 2/2 format-patch: teach format.notes config optionDenton Liu, May 8, 2019
  8. Beat BolliMay 8, 2019
  9. Denton LiuMay 8, 2019
  10. Beat BolliMay 8, 2019
  11. 0/2 format-patch: teach format.notes config optionDenton Liu, May 10, 2019
  12. 1/2 git-format-patch.txt: document --no-notes optionDenton Liu, May 10, 2019
  13. 2/2 format-patch: teach format.notes config optionDenton Liu, May 10, 2019
  14. Junio C HamanoMay 13, 2019
  15. Denton LiuMay 14, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.