Skip to content
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

Make repo creation for API similar to UI #6142

Merged
merged 3 commits into from
Feb 21, 2019

Conversation

jolheiser
Copy link
Member

Currently when creating a repo via the API and using the auto_init key while leaving the readme key blank, Gitea returns a 500 error Asset readme not found

This PR checks if auto_init was set to true and readme is left blank, set readme to Default.
On the UI, readme is defaulted as Default which is why the UI never encounters this error.

If it would make more sense to handle this "defaultness" in the model, I can move it there. I only added it to the API to mirror what the UI does.

One issue I can think of is if someone builds Gitea from source without bindata and removed the Default readme, this would no longer work. Not sure if that's in the scope of this PR though...

@techknowlogick techknowlogick added this to the 1.8.0 milestone Feb 20, 2019
@codecov-io
Copy link

codecov-io commented Feb 20, 2019

Codecov Report

Merging #6142 into master will increase coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6142      +/-   ##
==========================================
+ Coverage   38.82%   38.83%   +<.01%     
==========================================
  Files         354      354              
  Lines       50171    50174       +3     
==========================================
+ Hits        19477    19483       +6     
+ Misses      27873    27868       -5     
- Partials     2821     2823       +2
Impacted Files Coverage Δ
routers/api/v1/repo/repo.go 55.82% <0%> (-0.35%) ⬇️
routers/repo/view.go 42.07% <0%> (+0.99%) ⬆️
models/unit.go 14.28% <0%> (+14.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b61ff1...a12ccbf. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 20, 2019
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 21, 2019
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 21, 2019
@techknowlogick techknowlogick merged commit df30010 into go-gitea:master Feb 21, 2019
@jolheiser jolheiser deleted the API_repo_auto_init branch February 27, 2019 22:14
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants