File tree Expand file tree Collapse file tree 4 files changed +14
-0
lines changed Expand file tree Collapse file tree 4 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -851,6 +851,7 @@ func (g *GiteaLocalUploader) CreateReviews(reviews ...*base.Review) error {
851
851
// Rollback when migrating failed, this will rollback all the changes.
852
852
func (g * GiteaLocalUploader ) Rollback () error {
853
853
if g .repo != nil && g .repo .ID > 0 {
854
+ g .gitRepo .Close ()
854
855
if err := models .DeleteRepository (g .doer , g .repo .OwnerID , g .repo .ID ); err != nil {
855
856
return err
856
857
}
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ func DeleteRepo(ctx *context.Context) {
47
47
return
48
48
}
49
49
50
+ if ctx .Repo != nil && ctx .Repo .GitRepo != nil && ctx .Repo .Repository != nil && ctx .Repo .Repository .ID == repo .ID {
51
+ ctx .Repo .GitRepo .Close ()
52
+ }
53
+
50
54
if err := repo_service .DeleteRepository (ctx .User , repo ); err != nil {
51
55
ctx .ServerError ("DeleteRepository" , err )
52
56
return
Original file line number Diff line number Diff line change @@ -889,6 +889,10 @@ func Delete(ctx *context.APIContext) {
889
889
return
890
890
}
891
891
892
+ if ctx .Repo .GitRepo != nil {
893
+ ctx .Repo .GitRepo .Close ()
894
+ }
895
+
892
896
if err := repo_service .DeleteRepository (ctx .User , repo ); err != nil {
893
897
ctx .Error (http .StatusInternalServerError , "DeleteRepository" , err )
894
898
return
Original file line number Diff line number Diff line change @@ -544,6 +544,11 @@ func SettingsPost(ctx *context.Context) {
544
544
return
545
545
}
546
546
547
+ // Close the gitrepository before doing this.
548
+ if ctx .Repo .GitRepo != nil {
549
+ ctx .Repo .GitRepo .Close ()
550
+ }
551
+
547
552
if err := repo_service .DeleteRepository (ctx .User , ctx .Repo .Repository ); err != nil {
548
553
ctx .ServerError ("DeleteRepository" , err )
549
554
return
You can’t perform that action at this time.
0 commit comments