@@ -40,42 +40,52 @@ NAN_METHOD(GitRemote::ReferenceList)
4040void GitRemote::ReferenceListWorker::Execute ()
4141{
4242 giterr_clear ();
43- baton->error_code = git_remote_connect (
44- baton->remote ,
45- GIT_DIRECTION_FETCH ,
46- baton->callbacks ,
47- baton->proxy_opts ,
48- baton->custom_headers
49- );
5043
51- if (baton->error_code != GIT_OK ) {
52- baton->error = git_error_dup (giterr_last ());
53- delete baton->out ;
54- baton->out = NULL ;
55- return ;
56- }
44+ {
45+ LockMaster lockMaster (
46+ /* asyncAction: */ true ,
47+ baton->remote ,
48+ baton->callbacks ,
49+ baton->proxy_opts ,
50+ baton->custom_headers
51+ );
52+ baton->error_code = git_remote_connect (
53+ baton->remote ,
54+ GIT_DIRECTION_FETCH ,
55+ baton->callbacks ,
56+ baton->proxy_opts ,
57+ baton->custom_headers
58+ );
5759
58- const git_remote_head **remote_heads;
59- size_t num_remote_heads;
60- baton->error_code = git_remote_ls (
61- &remote_heads,
62- &num_remote_heads,
63- baton->remote
64- );
60+ if (baton->error_code != GIT_OK ) {
61+ baton->error = git_error_dup (giterr_last ());
62+ delete baton->out ;
63+ baton->out = NULL ;
64+ return ;
65+ }
6566
66- git_remote_disconnect (baton->remote );
67- if (baton->error_code != GIT_OK ) {
68- baton->error = git_error_dup (giterr_last ());
69- delete baton->out ;
70- baton->out = NULL ;
71- return ;
72- }
67+ const git_remote_head **remote_heads;
68+ size_t num_remote_heads;
69+ baton->error_code = git_remote_ls (
70+ &remote_heads,
71+ &num_remote_heads,
72+ baton->remote
73+ );
74+
75+ git_remote_disconnect (baton->remote );
76+ if (baton->error_code != GIT_OK ) {
77+ baton->error = git_error_dup (giterr_last ());
78+ delete baton->out ;
79+ baton->out = NULL ;
80+ return ;
81+ }
7382
74- baton->out ->reserve (num_remote_heads);
83+ baton->out ->reserve (num_remote_heads);
7584
76- for (size_t head_index = 0 ; head_index < num_remote_heads; ++head_index) {
77- git_remote_head *remote_head = git_remote_head_dup (remote_heads[head_index]);
78- baton->out ->push_back (remote_head);
85+ for (size_t head_index = 0 ; head_index < num_remote_heads; ++head_index) {
86+ git_remote_head *remote_head = git_remote_head_dup (remote_heads[head_index]);
87+ baton->out ->push_back (remote_head);
88+ }
7989 }
8090}
8191
@@ -89,7 +99,6 @@ void GitRemote::ReferenceListWorker::HandleOKCallback()
8999 Nan::Set (result, Nan::New<Number>(i), GitRemoteHead::New (baton->out ->at (i), true ));
90100 }
91101
92-
93102 delete baton->out ;
94103
95104 Local<v8::Value> argv[2 ] = {
0 commit comments