Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config-parse: split library out of config.[c|h]
The config parsing machinery (besides "include" directives) is usable by programs other than Git - it works with works with any file written in Git config syntax (IOW it doesn't rely on 'core' Git features like a repository), and as of the series ending at 6e8e798 (config: pass source to config_parser_event_fn_t, 2023-06-28), it no longer relies on global state. Thus, we can and should start turning it into a library other programs can use. Begin this process by splitting the config parsing code out of config.[c|h] and into config-parse.[c|h]. Do this without making changes to interfaces or function bodies, but tweak visibility and includes where appropriate, namely: - git_config_from_stdin() is now non-static so that it can be seen by config.c. - "struct config_source" is now defined in the .h file so that it can be seen by config.c. And as a result, config-lib.h needs to "#include strbuf.h". The resulting library is usable, though it is unergonomic to do so, e.g. the caller needs to "#include git-compat-util.h" and other dependencies, and we don't have an easy way of linking in the required objects besides using all of libgit.a. This isn't the end state we want for our libraries, but at least we have _some_ library whose usability we can improve in future series. Signed-off-by: Glen Choo <[email protected]>
- Loading branch information