-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rudimentary parser for Git config files #50
Conversation
Follow the dune spirit, i.e. stop prefixing modules with `Gitconfig_`.
I implemented @maiste's suggestions, and implemented utility functions to find |
97b5c91
to
327e557
Compare
Things are probably still a bit brittle, there may be corner cases in the parser or in the project name extractor that I didn't consider, but I think it can be a decent start. |
Thanks @OlivierNicole I'll merge this and people can create PRs for the various commands that should use this to guess the right project to use. |
CHANGES: ## Added * Various changes to rework lab cli client. (tmcgilchrist/ocaml-gitlab#50 tmcgilchrist/ocaml-gitlab#51 @maiste @tmcgilchrist @OlivierNicole) ## Bug fixes * Strip api/v4 from authorize and token url during OAuth. (tmcgilchrist/ocaml-gitlab#48 @tmcgilchrist) * Serialise milestone_id is an int. (tmcgilchrist/ocaml-gitlab#48 @tmcgilchrist) * Various merge_request webhook deserialisation fixes. (tmcgilchrist/ocaml-gitlab#47 @tmcgilchrist) * Fix incorrect field name, detected with atdgen 2.3.x (tmcgilchrist/ocaml-gitlab#46 @mjambon) * Fix commit_short_webhook prefix typo (tmcgilchrist/ocaml-gitlab#45 @MisterDA) * Update GHA to use windows-2022 (tmcgilchrist/ocaml-gitlab#44 @MisterDA) * Fix subcommands names and document env vars (tmcgilchrist/ocaml-gitlab#44 @MisterDA) * Document GITLAB_ env vars via Cmdliner (tmcgilchrist/ocaml-gitlab#44 @MisterDA) * Update cmdliner 1.1.0 API (tmcgilchrist/ocaml-gitlab#41 @MisterDA)
Parsing
.git/config
should be useful to get the remote URLs, and hence the project name in Gitlab (the project name, or its ID, is needed to perform project-related requests to the API).Is it a nice parser? No. Does it already exist elsewhere in a better version? Probably, although I couldn't find it. Git config files seem to be a form of INI files.
For now, nested sections are not supported properly. (They will parse, but the result will not be a hierarchy of sections.)