[go: up one dir, main page]

Skip to content

Error not raised on empty file update via API

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

  1. The documentation states that PUT method of repository files should return error code 400 if the new file contents are identical to the old ones.
  2. This error is not returned, and instead an empty commit is generated. anton-akhmerov/test@0f4e8a50 is an example of the empty commit

Steps to reproduce

I used the following script using the python-gitlab wrapper to confirm the behavior on gitlab.com:

import gitlab

gl = gitlab.Gitlab(url='https://gitlab.com', private_token="<private_token>")
p = gl.projects.get('anton-akhmerov/test')
f = p.files.get('README.md', 'master')
f.save(branch='master', commit_message='Update testfile', encoding='base64')

Example Project

See above.

What is the current bug behavior?

Empty commit generated, no error is raised.

What is the expected correct behavior?

No empty commit generated, 400 error returned.

Output of checks

This bug happens on GitLab.com

Edited by 🤖 GitLab Bot 🤖