gitea/modules/repository
zeripath 270c7f36db
Correctly rollback in ForkRepository () ()
Backport 

The rollback functionality in
services/repository/repository.go:ForkRepository is incorrect and could
lead to a deadlock as it uses DeleteRepository to delete the rolled-back
repository - a function which creates its own transaction.

This PR adjusts the rollback function to only use RemoveAll as any
database changes will be automatically rolled-back. It also handles
panics and adjusts the Close within WithTx to ensure that if there is a
panic the session will always be closed.

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

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
..
adopt.go Fix various documentation, user-facing, and source comment typos ()
archive.go Fix archive error when rename repo or user ()
branch.go [API] Add pagination to ListBranches ()
cache.go Make commit info cancelable ()
check.go Update repository size on cron gc task ()
commits.go Report the correct number of pushes on the feeds () ()
commits_test.go Implemented head_commit for webhooks ()
create.go Check if label template exist first ()
create_test.go Fixed assert statements. ()
fork.go Correctly rollback in ForkRepository () ()
fork_test.go Move create/fork repository from models to modules/repository ()
generate.go Ensure that HEAD is updated to match default branch in template generation ()
hooks.go Set GIT_DIR correctly if it is not set ()
init.go [API] Add pagination to ListBranches ()
main_test.go Move push commits from models to modules/repository ()
push.go Fix a bug on refactoring ()
repo.go Add push to remote mirror repository ()
update.go Move PushUpdateAddDeleteTags to repository module from models ()