@@ -63,7 +63,7 @@ function iscommit(id::AbstractString, repo::GitRepo)
63
63
if c === nothing
64
64
res = false
65
65
else
66
- finalize (c)
66
+ close (c)
67
67
end
68
68
catch
69
69
res = false
@@ -84,11 +84,11 @@ function isdiff(repo::GitRepo, treeish::AbstractString, paths::AbstractString=""
84
84
try
85
85
diff = diff_tree (repo, tree, paths)
86
86
result = count (diff) > 0
87
- finalize (diff)
87
+ close (diff)
88
88
catch err
89
89
result = true
90
90
finally
91
- finalize (tree)
91
+ close (tree)
92
92
end
93
93
return result
94
94
end
@@ -110,10 +110,10 @@ function diff_files(repo::GitRepo, branch1::AbstractString, branch2::AbstractStr
110
110
push! (files, unsafe_string (delta. new_file. path))
111
111
end
112
112
end
113
- finalize (diff)
113
+ close (diff)
114
114
finally
115
- finalize (tree1)
116
- finalize (tree2)
115
+ close (tree1)
116
+ close (tree2)
117
117
end
118
118
return files
119
119
end
@@ -163,7 +163,7 @@ function fetch{T<:AbstractString, P<:AbstractCredentials}(repo::GitRepo;
163
163
fo = FetchOptions (callbacks= RemoteCallbacks (credentials_cb (), payload))
164
164
fetch (rmt, refspecs, msg= " from $(url (rmt)) " , options = fo)
165
165
finally
166
- finalize (rmt)
166
+ close (rmt)
167
167
end
168
168
end
169
169
@@ -184,7 +184,7 @@ function push{T<:AbstractString, P<:AbstractCredentials}(repo::GitRepo;
184
184
push_opts= PushOptions (callbacks= RemoteCallbacks (credentials_cb (), payload))
185
185
push (rmt, refspecs, force= force, options= push_opts)
186
186
finally
187
- finalize (rmt)
187
+ close (rmt)
188
188
end
189
189
end
190
190
@@ -194,7 +194,7 @@ function branch(repo::GitRepo)
194
194
try
195
195
branch (head_ref)
196
196
finally
197
- finalize (head_ref)
197
+ close (head_ref)
198
198
end
199
199
end
200
200
@@ -220,7 +220,7 @@ function branch!(repo::GitRepo, branch_name::AbstractString,
220
220
tmpcmt = with (peel (GitCommit, branch_rmt_ref)) do hrc
221
221
Oid (hrc)
222
222
end
223
- finalize (branch_rmt_ref)
223
+ close (branch_rmt_ref)
224
224
tmpcmt
225
225
end
226
226
else
@@ -232,7 +232,7 @@ function branch!(repo::GitRepo, branch_name::AbstractString,
232
232
try
233
233
new_branch_ref = create_branch (repo, branch_name, cmt, force= force)
234
234
finally
235
- finalize (cmt)
235
+ close (cmt)
236
236
new_branch_ref === nothing && throw (GitError (Error. Object, Error. ERROR, " cannot create branch `$branch_name ` with `$commit_id `" ))
237
237
branch_ref = new_branch_ref
238
238
end
@@ -260,7 +260,7 @@ function branch!(repo::GitRepo, branch_name::AbstractString,
260
260
head! (repo, branch_ref)
261
261
end
262
262
finally
263
- finalize (branch_ref)
263
+ close (branch_ref)
264
264
end
265
265
return
266
266
end
@@ -296,15 +296,15 @@ function checkout!(repo::GitRepo, commit::AbstractString = "";
296
296
obj_oid = Oid (peeled)
297
297
ref = GitReference (repo, obj_oid, force= force,
298
298
msg= " libgit2.checkout: moving from $head_name to $(string (obj_oid)) " )
299
- finalize (ref)
299
+ close (ref)
300
300
301
301
# checkout commit
302
302
checkout_tree (repo, peeled, options = opts)
303
303
finally
304
- finalize (peeled)
304
+ close (peeled)
305
305
end
306
306
finally
307
- finalize (obj)
307
+ close (obj)
308
308
end
309
309
end
310
310
@@ -335,7 +335,7 @@ function reset!(repo::GitRepo, committish::AbstractString, pathspecs::AbstractSt
335
335
try
336
336
reset! (repo, Nullable (obj), pathspecs... )
337
337
finally
338
- finalize (obj)
338
+ close (obj)
339
339
end
340
340
end
341
341
@@ -347,7 +347,7 @@ function reset!(repo::GitRepo, commit::Oid, mode::Cint = Consts.RESET_MIXED)
347
347
try
348
348
reset! (repo, obj, mode)
349
349
finally
350
- finalize (obj)
350
+ close (obj)
351
351
end
352
352
end
353
353
@@ -409,12 +409,15 @@ function merge!(repo::GitRepo;
409
409
throw (GitError (Error. Merge, Error. ERROR,
410
410
" Repository HEAD is detached. Remote tracking branch cannot be used." ))
411
411
end
412
- with (upstream (head_ref)) do tr_brn_ref
413
- if tr_brn_ref === nothing
414
- throw (GitError (Error. Merge, Error. ERROR,
415
- " There is no tracking information for the current branch." ))
416
- end
412
+ tr_brn_ref = upstream (head_ref)
413
+ if tr_brn_ref === nothing
414
+ throw (GitError (Error. Merge, Error. ERROR,
415
+ " There is no tracking information for the current branch." ))
416
+ end
417
+ try
417
418
[GitAnnotated (repo, tr_brn_ref)]
419
+ finally
420
+ close (tr_brn_ref)
418
421
end
419
422
end
420
423
end
@@ -424,7 +427,7 @@ function merge!(repo::GitRepo;
424
427
merge_opts= merge_opts,
425
428
checkout_opts= checkout_opts)
426
429
finally
427
- map (finalize , upst_anns)
430
+ map (close , upst_anns)
428
431
end
429
432
end
430
433
end
@@ -434,12 +437,15 @@ function rebase!(repo::GitRepo, upstream::AbstractString="", newbase::AbstractSt
434
437
with (head (repo)) do head_ref
435
438
head_ann = GitAnnotated (repo, head_ref)
436
439
upst_ann = if isempty (upstream)
437
- with (LibGit2. upstream (head_ref)) do brn_ref
438
- if brn_ref === nothing
439
- throw (GitError (Error. Rebase, Error. ERROR,
440
- " There is no tracking information for the current branch." ))
441
- end
440
+ brn_ref = LibGit2. upstream (head_ref)
441
+ if brn_ref === nothing
442
+ throw (GitError (Error. Rebase, Error. ERROR,
443
+ " There is no tracking information for the current branch." ))
444
+ end
445
+ try
442
446
GitAnnotated (repo, brn_ref)
447
+ finally
448
+ close (brn_ref)
443
449
end
444
450
else
445
451
GitAnnotated (repo, upstream)
@@ -456,15 +462,15 @@ function rebase!(repo::GitRepo, upstream::AbstractString="", newbase::AbstractSt
456
462
catch err
457
463
abort (rbs)
458
464
finally
459
- finalize (rbs)
465
+ close (rbs)
460
466
end
461
467
finally
462
- # !isnull(onto_ann) && finalize (get(onto_ann))
463
- finalize (sig)
468
+ # !isnull(onto_ann) && close (get(onto_ann))
469
+ close (sig)
464
470
end
465
471
finally
466
- finalize (upst_ann)
467
- finalize (head_ann)
472
+ close (upst_ann)
473
+ close (head_ann)
468
474
end
469
475
end
470
476
return nothing
@@ -522,7 +528,7 @@ function transact(f::Function, repo::GitRepo)
522
528
restore (state, repo)
523
529
rethrow ()
524
530
finally
525
- finalize (repo)
531
+ close (repo)
526
532
end
527
533
end
528
534
0 commit comments