Skip to content

Add author_name and author_email to RepositoryFile#1314

Open
mhagnumdw wants to merge 1 commit intogitlab4j:mainfrom
mhagnumdw:set-author-repository-file
Open

Add author_name and author_email to RepositoryFile#1314
mhagnumdw wants to merge 1 commit intogitlab4j:mainfrom
mhagnumdw:set-author-repository-file

Conversation

@mhagnumdw
Copy link
Copy Markdown
Contributor

According to the GitLab documentation https://docs.gitlab.com/api/repository_files/#create-a-file-in-a-repository

It's possible to define the author's email address and commit author's name.

I added these parameters to the RepositoryFile and have already successfully performed local tests.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure the gitlab sends those attributes?

Doc: https://docs.gitlab.com/api/repository_files/#retrieve-a-file-from-a-repository

GET https://<server>/api/v4/projects/<id>/repository/files/<path>?ref=main

Is sending back:

{
  "file_name": "file.txt",
  "file_path": "file.txt",
  "size": 560,
  "encoding": "base64",
  "content_sha256": "1dd2cbbc6db2d37daa8397ef186cabcd365d366358c5130d3e321c62868a49af",
  "ref": "main",
  "blob_id": "e2a869f70d890f99ed3e86f069da49dabdac8a78",
  "commit_id": "5dd394122833ccade0474991125f73cd2514f52c",
  "last_commit_id": "af6990f7c535fd200bb9ec44acd1b99e79ee4746",
  "execute_filemode": false,
  "content": "..."
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I've noticed a difference. The same class RepositoryFile is used to create and get a file.

When creating the file, the author_name and author_email attributes exist, but not when retrieving it.

Do you have any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants