Skip to content

git: Allow ConfigPair to be used as GlobalOption

Patrick Steinhardt requested to merge pks-config-pair-global-opt into master

Using the ConfigPair option as a GlobalOption is currently not possible because in the past, it was only used as parameter for git-config(1). This means that every SafeCmd which uses configuration parameters needs to assemble its own format which is understood by git via a normal ValueFlag. Which is not ideal given that it distributes knowledge on how the format looks like, makes it harder than necessary to find any configuration and that it cannot verify the format.

This commit thus extends the ConfigPair to also implement the GlobalOption interface. Like this, we can easily verify the format of the configuration key to look as expected, namely that we have the typical section.optional_subsection.key format which git expects. Furthermore, we can now verify that the key doesn't contain any equals signs. This is important, as git always interprets the first equals sign it sees as the separator between key and value. If the key already contains an equals sign, this would mean that the configuration key is misparsed.

Merge request reports

Loading