-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Unable to create empty file #2427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Have you tried calculating the SHA of an empty byte slice? $ touch bogus
$ shasum bogus
da39a3ee5e6b4b0d3255bfef95601890afd80709 bogus
$ ls -la bogus
-rw-rw-r-- 1 glenn glenn 0 Aug 1 19:06 bogus Try passing in this SHA when your file is empty and see if that works. |
That does not work, I continue to get a
|
OK, gotcha. Then I think we have a bug that needs to be fixed. My main concern is that we don't break existing behavior where Do you want to submit a PR or would you like me to open this up to other contributors to this repo to address? |
I do not think there should be any problems with breaking existing behavior with this because looking at the update file contents endpoint it does appear that they label the |
When attempting to commit an empty file to a repository using
ghClient.Repositories.CreateFile
and passing in[]byte{}
under theContent
field of agithub.RepositoryContentFileOptions
the GitHub API will return a422
error stating thatcontent
was not supplied. This is most likely due to the line:go-github/github/repos_contents.go
Line 54 in 7a7a7f0
Which adds
omitempty
to theContent
field ofgithub.RepositoryContentFileOptions
, even though it is a necessary field of the request.The text was updated successfully, but these errors were encountered: