project creation ignores default_branch and default-branch contradicts documentation #3182
-
Description of the problem, including code/CLI snippetI've spent a couple hours on this, but basically when creating a project from the python package or from CLI, the
The same thing happens from CLI:
Expected BehaviorAfter creation as described, the project object should show Regardless of being created from CLI or SDK. Actual BehaviorThe CLI and SDK both show that the default branch is "main". The console says that a default branch cannot be set on an empty repo. If this is not possible because of how the gitlab package is a thin wrapper over gitlab REST API, the readme in this repo should at least mention such discrepencies between the docs (auto generated from the REST API, shown in the CLI --help output) and actual behavior. Workaround (possibly a hack)Call these 2 functions, in order:
After running these 2, the git repo will have only master branch, and gitlab console will show this and that it is default and protected, Specifications
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Maybe try with |
Beta Was this translation helpful? Give feedback.
-
@JohnVillalovos thanks that's interesting. Led me to this: #2869 (comment), and in particular
I'm thinking that could be the cause here, since the gitlab account is part of an organization where there could be such rules in place, is there a way that I can verify whether that's the case? |
Beta Was this translation helpful? Give feedback.
-
So adding However I still think it would be useful to make this more obvious. I searched the web and all the hits I find, nothing indicates that Also I guess this should be converted back to an issue? |
Beta Was this translation helpful? Give feedback.
Maybe try with
initialize_with_readme
?