Closed OlivierNicole closed 2 years ago
I implemented @maiste's suggestions, and implemented utility functions to find .git/config
and read the project name from it.
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.
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.)