]> git.ipfire.org Git - thirdparty/git.git/commit
fetch: lift up parsing of "fetch.output" config variable
authorPatrick Steinhardt <ps@pks.im>
Wed, 10 May 2023 12:34:28 +0000 (14:34 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 10 May 2023 17:35:25 +0000 (10:35 -0700)
commit58afbe885c678c5cc6f6f83badca159871fc2cb3
tree908b937ec179e354f85248c251d570f3a42353ae
parent50957937f92691215492f4c62dd0a18e39f17a2e
fetch: lift up parsing of "fetch.output" config variable

Parsing the display format happens inside of `display_state_init()`. As
we only need to check for a simple config entry, this is a natural
location to put this code as it means that display-state logic is neatly
contained in a single location.

We're about to introduce a new "porcelain" output format though that is
intended to be parseable by machines, for example inside of a script.
This format can be enabled by passing the `--porcelain` switch to
git-fetch(1). As a consequence, we'll have to add a second callsite that
influences the output format, which will become awkward to handle.

Refactor the code such that callers are expected to pass the display
format that is to be used into `display_state_init()`. This allows us to
lift up the code into the main function, where we can then hook it into
command line options parser in a follow-up commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c