bench-forgejo/routers
Anton Khimich 5a18712dd7
Fix PATCH /repos/{owner}/{repo} panic (#14637)
* Fix a runtime error when modifying a repository through API call

Using the `PATCH /repos/{owner}/{repo}` endpoint and attempting to
modify `default_branch` on an empty repository will cause a
panic. This commit adds a check for a nil pointer before attempting
to dereference it.

* Apply suggestions from code review

* Apply suggestions from code review

* Ensure that the git repository is loaded

If you change the default branch for a repository you must change it in
git too. Therefore you must open the repository before changing the
default branch.

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Allow empty repos to have their default branches changed

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Anton Khimich <anton.khimicha@mail.utoronto.ca>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Andrew Thornton <art27@cantab.net>
2021-02-11 20:53:41 +01:00
..
admin Update docs and comments to remove macaron (#14491) 2021-01-29 16:35:30 +01:00
api/v1 Fix PATCH /repos/{owner}/{repo} panic (#14637) 2021-02-11 20:53:41 +01:00
dev Display ui time with customize time location (#7792) 2019-08-15 22:46:21 +08:00
events Add EventSource support (#11235) 2020-05-07 22:49:00 +01:00
org Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
private Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00
repo Add dismiss review feature (#12674) 2021-02-11 18:32:25 +01:00
routes Added option to disable webhooks (#13176) 2021-02-11 12:34:34 -05:00
user Honor REGISTER_MANUAL_CONFIRM when doing openid registration (#14548) 2021-02-05 04:03:20 +01:00
utils Return the full rejection message and errors in flash errors (#13221) 2020-10-20 19:50:10 -04:00
home.go [Feature] add precise search type for Elastic Search (#12869) 2021-01-27 12:00:35 +02:00
init.go Print usefull error if SQLite is used in settings but not supported (#14476) 2021-01-27 04:57:18 +01:00
install.go Move middlewares to web/middleware (#14480) 2021-01-30 10:55:53 +02:00
metrics.go Move metrics from macaron to chi (#13601) 2020-11-17 15:50:06 -05:00
swagger_json.go Move macaron to chi (#14293) 2021-01-26 16:36:53 +01:00