diff options
author | Anton Khimich <anton.khimich@gmail.com> | 2021-02-11 14:53:41 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 20:53:41 +0100 |
commit | 5a18712dd7dcffecf88d3071381a836a543d8f2a (patch) | |
tree | 56772aae2f83be47ccd416b506f522a5f6845d78 /public | |
parent | 441f3f0f205234e8cb8d7bac90ed115ebd2e9d43 (diff) | |
download | gitea-5a18712dd7dcffecf88d3071381a836a543d8f2a.tar.gz gitea-5a18712dd7dcffecf88d3071381a836a543d8f2a.zip |
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>
Diffstat (limited to 'public')
0 files changed, 0 insertions, 0 deletions