python-gitlab / python-gitlab

A python wrapper for the GitLab API.

Home Page:https://python-gitlab.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to initialize repo with readme when creating project on behalf of user

connelldave opened this issue · comments

Description of the problem, including code/CLI snippet

When creating a project on behalf of user u as an admin, initialize_with_readme is ignored

In [32]: init_with_readme = True

In [33]: 
    ...:         project_data = {
    ...:             "name": project_name,
    ...:             "namespace_id": group_id,
    ...:             "initialize_with_readme": init_with_readme,
    ...:             "visibility": "internal",
    ...:         }

In [34]: r = u.projects.create(project_data)

In [35]: r.visibility
Out[35]: 'internal'

I think this might be because the attr is not declared in users.py like it is in projects.py?

Looks like an extension of #765 in a different object?

Expected Behavior

Repo is initialized with a default readme

Actual Behavior

Repo is not initialized

Specifications

  • python-gitlab version: tested on 3.12.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): v16.10.4-ee

I think this was actually just my falling foul of a user being a developer in a group with fully protected default branches - the defined attrs don't seem to restrict what's passed? I produced expected behaviour in a users own namespace, so can close this