]> git.ipfire.org Git - thirdparty/git.git/commit - config.c
git_config_set: do not use a state machine
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 9 Apr 2018 08:32:17 +0000 (10:32 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Apr 2018 12:32:59 +0000 (21:32 +0900)
commit5221c3159f670281ff36b6adbdf568661e930b50
tree4bedef54229b742cab44133c20c20dfea9afe150
parent668b9ade6bcafbed1577468902d27c05c17cf026
git_config_set: do not use a state machine

While a neat theoretical construct, state machines are hard to read. In
this instance, it does not even make a whole lot of sense because we are
more interested in flags, anyway: has the section been seen? Has the key
been seen? Does the current section match the key we are looking for?

Besides, the state `SECTION_SEEN` was named in a misleading way: it did
not indicate that we saw the section matching the key we are looking
for, but it instead indicated that we are *currently* in that section.

Let's just replace the state machine logic by clear and obvious flags.

This will also make it easier to review the upcoming patches to use the
newly-introduced `event_fn` callback of the config parser.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c