Denton Liu <[email protected]> writes:
> 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 <[email protected]>
> ---
> 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.
> 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.
> +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