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 @@ -849,6 +849,7 @@ func (g *GiteaLocalUploader) CreateReviews(reviews ...*base.Review) error {
849
849
// Rollback when migrating failed, this will rollback all the changes.
850
850
func (g * GiteaLocalUploader ) Rollback () error {
851
851
if g .repo != nil && g .repo .ID > 0 {
852
+ g .gitRepo .Close ()
852
853
if err := models .DeleteRepository (g .doer , g .repo .OwnerID , g .repo .ID ); err != nil {
853
854
return err
854
855
}
Original file line number Diff line number Diff line change @@ -46,6 +46,10 @@ func DeleteRepo(ctx *context.Context) {
46
46
return
47
47
}
48
48
49
+ if ctx .Repo != nil && ctx .Repo .GitRepo != nil && ctx .Repo .Repository != nil && ctx .Repo .Repository .ID == repo .ID {
50
+ ctx .Repo .GitRepo .Close ()
51
+ }
52
+
49
53
if err := repo_service .DeleteRepository (ctx .User , repo ); err != nil {
50
54
ctx .ServerError ("DeleteRepository" , err )
51
55
return
Original file line number Diff line number Diff line change @@ -885,6 +885,10 @@ func Delete(ctx *context.APIContext) {
885
885
return
886
886
}
887
887
888
+ if ctx .Repo .GitRepo != nil {
889
+ ctx .Repo .GitRepo .Close ()
890
+ }
891
+
888
892
if err := repo_service .DeleteRepository (ctx .User , repo ); err != nil {
889
893
ctx .Error (http .StatusInternalServerError , "DeleteRepository" , err )
890
894
return
Original file line number Diff line number Diff line change @@ -539,6 +539,11 @@ func SettingsPost(ctx *context.Context) {
539
539
return
540
540
}
541
541
542
+ // Close the gitrepository before doing this.
543
+ if ctx .Repo .GitRepo != nil {
544
+ ctx .Repo .GitRepo .Close ()
545
+ }
546
+
542
547
if err := repo_service .DeleteRepository (ctx .User , ctx .Repo .Repository ); err != nil {
543
548
ctx .ServerError ("DeleteRepository" , err )
544
549
return
You can’t perform that action at this time.
0 commit comments