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