]> git.ipfire.org Git - thirdparty/git.git/commit
format-patch: use --notes behavior for format.notes
authorDenton Liu <liu.denton@gmail.com>
Mon, 9 Dec 2019 13:10:46 +0000 (05:10 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Dec 2019 21:37:20 +0000 (13:37 -0800)
commit8164c961e16834da283cbf5ac5d22313b982a484
treefb4dc18bb93b80061d0879985538d87a82f298f5
parent452538c3586a76939faf43019fb7c21b3147309b
format-patch: use --notes behavior for format.notes

When we had multiple `format.notes` config values where we had `<ref1>`,
`false`, `<ref2>` (in that order), then we would print out the notes for
both `<ref1>` and `<ref2>`. This doesn't make sense, however, since we
parse the config in a top-down manner and a `false` should be able to
override previous configurations, just like how `--no-notes` will
override previous `--notes`.

Duplicate the logic that handles the `--[no-]notes[=]` option to
`format.notes` for consistency. As a result, when parsing the config
from top to bottom, `format.notes = true` will behave like `--notes`,
`format.notes = <ref>` will behave like `--notes=<ref>` and
`format.notes = false` will behave like `--no-notes`.

This change isn't strictly backwards compatible but since it is an edge
case where a sane user would not mix notes refs with `false` and this
feature is relatively new (released only in v2.23.0), this change should
be harmless.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/log.c
t/t4014-format-patch.sh