mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
gitweb: Improve error handling when creating repository
If an error occurs during creation of a git repository, delete possibly corrupted git repository directory and show more specific error message. Closes #1829 Tests performed: - Gitweb unit and functional tests pass - Create a small disk for git repositories: > dd if=/dev/zero of=disk.img iflag=fullblock bs=128k count=100 && sync > mkfs.ext4 disk.img > mount -o loop disk.img /var/lib/git/ - Clone a large repository https://salsa.debian.org/freedombox-team/plinth Disk got full during cloning remote repository. Repository listing do not show this repository anymore. (No errors is shown to the user.) - Fill disk space: > head -c 1G </dev/urandom > /var/lib/git/myfile - Disk is full. Cloning an existing remote repository fails with an error message (No space left on device) - Disk is full. Creating a new repository fails with an error message (No space left on device) Signed-off-by: Veiko Aasa <veiko17@disroot.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
202980b6d5
commit
d26e87661b
3 files changed
+41
-22
No files matched your search
@@ -60,11 +60,15 @@ class CreateRepoView(SuccessMessageMixin, FormView):
|
||||
try:
|
||||
gitweb.create_repo(form_data['name'], form_data['description'],
|
||||
form_data['owner'], form_data['is_private'])
|
||||
except ActionError:
|
||||
except ActionError as error:
|
||||
self.success_message = ''
|
||||
error_text = error.args[2].split('\n')[0]
|
||||
messages.error(
|
||||
self.request,
|
||||
_('An error occurred while creating the repository.'))
|
||||
gitweb.app.update_service_access()
|
||||
self.request, "{0} {1}".format(
|
||||
_('An error occurred while creating the repository.'),
|
||||
error_text))
|
||||
else:
|
||||
gitweb.app.update_service_access()
|
||||
|
||||
return super().form_valid(form)
|
||||
|
||||
|
||||
Reference in new issue
Block a user