@@ -9,7 +9,6 @@ Copyright (c) 2011, Tim Branyen @tbranyen <tim@tabdeveloper.com>
99
1010#include " ../vendor/libgit2/include/git2.h"
1111
12- #include " reference.h"
1312#include " object.h"
1413#include " repo.h"
1514#include " commit.h"
@@ -30,7 +29,6 @@ void Repo::Initialize(Handle<Object> target) {
3029 NODE_SET_PROTOTYPE_METHOD (constructor_template, " lookup" , Lookup);
3130 NODE_SET_PROTOTYPE_METHOD (constructor_template, " free" , Free);
3231 NODE_SET_PROTOTYPE_METHOD (constructor_template, " init" , Init);
33- NODE_SET_PROTOTYPE_METHOD (constructor_template, " lookupRef" , LookupRef);
3432
3533 target->Set (String::NewSymbol (" Repo" ), constructor_template->GetFunction ());
3634}
@@ -62,10 +60,6 @@ int Repo::Init(const char* path, bool is_bare) {
6260 return err;
6361}
6462
65- int Repo::LookupRef (git_reference** ref, const char * name) {
66- return git_repository_lookup_ref (ref, *&this ->repo , name);
67- }
68-
6963Handle<Value> Repo::New (const Arguments& args) {
7064 HandleScope scope;
7165
@@ -169,8 +163,8 @@ Handle<Value> Repo::Lookup(const Arguments& args) {
169163
170164 repo->Ref ();
171165
172- eio_custom (EIO_LookupRef, EIO_PRI_DEFAULT , EIO_AfterLookupRef, ar);
173- ev_ref (EV_DEFAULT_UC );
166+ // eio_custom(EIO_LookupRef, EIO_PRI_DEFAULT, EIO_AfterLookupRef, ar);
167+ // ev_ref(EV_DEFAULT_UC);
174168
175169 return Undefined ();
176170}
@@ -295,81 +289,4 @@ int Repo::EIO_AfterInit(eio_req *req) {
295289
296290 return 0 ;
297291}
298-
299- Handle<Value> Repo::LookupRef (const Arguments& args) {
300- Repo *repo = ObjectWrap::Unwrap<Repo>(args.This ());
301- Local<Function> callback;
302-
303- HandleScope scope;
304-
305- if (args.Length () == 0 || !args[0 ]->IsObject ()) {
306- return ThrowException (Exception::Error (String::New (" Reference is required and must be a Object." )));
307- }
308-
309- if (args.Length () == 1 || !args[1 ]->IsString ()) {
310- return ThrowException (Exception::Error (String::New (" Name is required and must be a String." )));
311- }
312-
313- if (args.Length () == 2 || !args[2 ]->IsFunction ()) {
314- return ThrowException (Exception::Error (String::New (" Callback is required and must be a Function." )));
315- }
316-
317- callback = Local<Function>::Cast (args[2 ]);
318-
319- lookupref_request *ar = new lookupref_request ();
320- ar->repo = repo;
321- ar->ref = ObjectWrap::Unwrap<Reference>(args[0 ]->ToObject ());
322-
323- String::Utf8Value name (args[1 ]);
324- ar->name = *name;
325-
326- ar->callback = Persistent<Function>::New (callback);
327-
328- repo->Ref ();
329-
330- eio_custom (EIO_LookupRef, EIO_PRI_DEFAULT , EIO_AfterLookupRef, ar);
331- ev_ref (EV_DEFAULT_UC );
332-
333- return Undefined ();
334- }
335-
336- int Repo::EIO_LookupRef (eio_req *req) {
337- lookupref_request *ar = static_cast <lookupref_request *>(req->data );
338-
339- git_reference* ref = ar->ref ->GetValue ();
340- git_reference** out = &ref;
341-
342- ar->err = ar->repo ->LookupRef (out, ar->name .c_str ());
343-
344- if (ar->err == 0 ) {
345- ar->ref ->SetValue (*out);
346- }
347-
348- return 0 ;
349- }
350-
351- int Repo::EIO_AfterLookupRef (eio_req *req) {
352- HandleScope scope;
353-
354- lookupref_request *ar = static_cast <lookupref_request *>(req->data );
355- ev_unref (EV_DEFAULT_UC );
356- ar->repo ->Unref ();
357-
358- Local<Value> argv[1 ];
359- argv[0 ] = Integer::New (ar->err );
360-
361- TryCatch try_catch;
362-
363- ar->callback ->Call (Context::GetCurrent ()->Global (), 1 , argv);
364-
365- if (try_catch.HasCaught ())
366- FatalException (try_catch);
367-
368- ar->callback .Dispose ();
369-
370- delete ar;
371-
372- return 0 ;
373- }
374-
375292Persistent<FunctionTemplate> Repo::constructor_template;
0 commit comments