@@ -120,13 +120,16 @@ func LFSLocks(ctx *context.Context) {
120
120
}); err != nil {
121
121
log .Error ("Failed to clone repository: %s (%v)" , ctx .Repo .Repository .FullName (), err )
122
122
ctx .ServerError ("LFSLocks" , fmt .Errorf ("Failed to clone repository: %s (%v)" , ctx .Repo .Repository .FullName (), err ))
123
+ return
123
124
}
124
125
125
126
gitRepo , err := git .OpenRepository (tmpBasePath )
126
127
if err != nil {
127
128
log .Error ("Unable to open temporary repository: %s (%v)" , tmpBasePath , err )
128
129
ctx .ServerError ("LFSLocks" , fmt .Errorf ("Failed to open new temporary repository in: %s %v" , tmpBasePath , err ))
130
+ return
129
131
}
132
+ defer gitRepo .Close ()
130
133
131
134
filenames := make ([]string , len (lfsLocks ))
132
135
@@ -137,6 +140,7 @@ func LFSLocks(ctx *context.Context) {
137
140
if err := gitRepo .ReadTreeToIndex (ctx .Repo .Repository .DefaultBranch ); err != nil {
138
141
log .Error ("Unable to read the default branch to the index: %s (%v)" , ctx .Repo .Repository .DefaultBranch , err )
139
142
ctx .ServerError ("LFSLocks" , fmt .Errorf ("Unable to read the default branch to the index: %s (%v)" , ctx .Repo .Repository .DefaultBranch , err ))
143
+ return
140
144
}
141
145
142
146
name2attribute2info , err := gitRepo .CheckAttribute (git.CheckAttributeOpts {
@@ -147,6 +151,7 @@ func LFSLocks(ctx *context.Context) {
147
151
if err != nil {
148
152
log .Error ("Unable to check attributes in %s (%v)" , tmpBasePath , err )
149
153
ctx .ServerError ("LFSLocks" , err )
154
+ return
150
155
}
151
156
152
157
lockables := make ([]bool , len (lfsLocks ))
@@ -166,6 +171,7 @@ func LFSLocks(ctx *context.Context) {
166
171
if err != nil {
167
172
log .Error ("Unable to lsfiles in %s (%v)" , tmpBasePath , err )
168
173
ctx .ServerError ("LFSLocks" , err )
174
+ return
169
175
}
170
176
171
177
filemap := make (map [string ]bool , len (filelist ))
0 commit comments