From b42cc69290b39657145b89ef425171fb82e0c4e9 Mon Sep 17 00:00:00 2001 From: Michael Robinson Date: Tue, 26 Feb 2013 22:57:24 +1300 Subject: [PATCH 1/5] Ignore .DS_Store --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index da0fdf8dd..91f748bb6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ doc !doc/Theme.css example/stress/test node_modules +.DS_Store From 1f5926fce1622ea0a1bdb238fefcb94ffa457f9d Mon Sep 17 00:00:00 2001 From: Michael Robinson Date: Tue, 26 Feb 2013 23:11:52 +1300 Subject: [PATCH 2/5] Convert from eio_custom to uv_queue_work --- include/blob.h | 13 ++++--------- include/commit.h | 8 ++++---- include/reference.h | 4 ++-- include/repo.h | 12 ++++++------ include/revwalk.h | 4 ++-- include/tree.h | 12 ++++++------ src/blob.cc | 19 +++++++++---------- src/commit.cc | 34 +++++++++++++++++----------------- src/reference.cc | 17 ++++++++--------- src/repo.cc | 40 +++++++++++++++++++--------------------- src/revwalk.cc | 19 +++++++++---------- src/tree.cc | 42 ++++++++++++++++++++---------------------- src/tree_entry.cc | 6 +++--- 13 files changed, 109 insertions(+), 121 deletions(-) diff --git a/include/blob.h b/include/blob.h index 34ed78b08..0426e8c88 100755 --- a/include/blob.h +++ b/include/blob.h @@ -132,22 +132,17 @@ class GitBlob : public ObjectWrap { * Function: EIO_Lookup * * Parameters: - * req - an eio_req pointer + * req - an uv_work_t pointer * - * Returns: - * completion code integer */ - static void EIO_Lookup(eio_req* req); + static void EIO_Lookup(uv_work_t* req); /** * Function: EIO_AfterLookup * * Parameters: - * req - an eio_req pointer - * - * Returns: - * completion code integer + * req - an uv_work_t pointer */ - static int EIO_AfterLookup(eio_req* req); + static void EIO_AfterLookup(uv_work_t* req); /** * Function: RawContent * diff --git a/include/commit.h b/include/commit.h index d3a4229a8..90147d9e7 100755 --- a/include/commit.h +++ b/include/commit.h @@ -58,8 +58,8 @@ class GitCommit : public ObjectWrap { static Handle New(const Arguments& args); static Handle Lookup(const Arguments& args); - static void EIO_Lookup(eio_req *req); - static int EIO_AfterLookup(eio_req *req); + static void EIO_Lookup(uv_work_t *req); + static void EIO_AfterLookup(uv_work_t *req); static Handle Close(const Arguments& args); static Handle Id(const Arguments& args); @@ -71,8 +71,8 @@ class GitCommit : public ObjectWrap { static Handle Author(const Arguments& args); static Handle Tree(const Arguments& args); - static int EIO_Tree(eio_req* req); - static int EIO_AfterTree(eio_req* req); + static void EIO_Tree(uv_work_t* req); + static void EIO_AfterTree(uv_work_t* req); static Handle ParentCount(const Arguments& args); static Handle Parent(const Arguments& args); diff --git a/include/reference.h b/include/reference.h index cbe3caf85..8037f2dad 100755 --- a/include/reference.h +++ b/include/reference.h @@ -32,8 +32,8 @@ class GitReference : public ObjectWrap { static Handle New(const Arguments& args); static Handle Lookup(const Arguments& args); - static void EIO_Lookup(eio_req* req); - static int EIO_AfterLookup(eio_req* req); + static void EIO_Lookup(uv_work_t* req); + static void EIO_AfterLookup(uv_work_t* req); static Handle Oid(const Arguments& args); diff --git a/include/repo.h b/include/repo.h index c840036f4..322f5b3b3 100755 --- a/include/repo.h +++ b/include/repo.h @@ -42,18 +42,18 @@ class GitRepo : public ObjectWrap { static Handle New(const Arguments& args); static Handle Open(const Arguments& args); - static void EIO_Open(eio_req* req); - static int EIO_AfterOpen(eio_req* req); + static void EIO_Open(uv_work_t* req); + static void EIO_AfterOpen(uv_work_t* req); static Handle Lookup(const Arguments& args); - static int EIO_Lookup(eio_req* req); - static int EIO_AfterLookup(eio_req* req); + static void EIO_Lookup(uv_work_t* req); + static void EIO_AfterLookup(uv_work_t* req); static Handle Free(const Arguments& args); static Handle Init(const Arguments& args); - static void EIO_Init(eio_req* req); - static int EIO_AfterInit(eio_req* req); + static void EIO_Init(uv_work_t* req); + static void EIO_AfterInit(uv_work_t* req); private: git_repository* repo; diff --git a/include/revwalk.h b/include/revwalk.h index 2e1db881e..203e2cf53 100755 --- a/include/revwalk.h +++ b/include/revwalk.h @@ -41,8 +41,8 @@ class GitRevWalk : public ObjectWrap { static Handle Hide(const Arguments& args); static Handle Next(const Arguments& args); - static void EIO_Next(eio_req* req); - static int EIO_AfterNext(eio_req* req); + static void EIO_Next(uv_work_t* req); + static void EIO_AfterNext(uv_work_t* req); static Handle Sorting(const Arguments& args); static Handle Free(const Arguments& args); diff --git a/include/tree.h b/include/tree.h index 74c748aab..2b8839032 100755 --- a/include/tree.h +++ b/include/tree.h @@ -93,15 +93,15 @@ class GitTree : public ObjectWrap { static Handle New(const Arguments& args); static Handle Lookup(const Arguments& args); - static int EIO_Lookup(eio_req *req); - static int EIO_AfterLookup(eio_req *req); + static void EIO_Lookup(uv_work_t *req); + static void EIO_AfterLookup(uv_work_t *req); static Handle EntryCount(const Arguments& args); static Handle EntryByIndex(const Arguments& args); - static void EIO_EntryByIndex(eio_req *req); - static int EIO_AfterEntryByIndex(eio_req *req); + static void EIO_EntryByIndex(uv_work_t *req); + static void EIO_AfterEntryByIndex(uv_work_t *req); static Handle EntryByName(const Arguments& args); - static void EIO_EntryByName(eio_req *req); - static int EIO_AfterEntryByName(eio_req *req); + static void EIO_EntryByName(uv_work_t *req); + static void EIO_AfterEntryByName(uv_work_t *req); static Handle SortEntries(const Arguments& args); static Handle ClearEntries(const Arguments& args); diff --git a/src/blob.cc b/src/blob.cc index 3ef5668a8..3d3069f5b 100755 --- a/src/blob.cc +++ b/src/blob.cc @@ -21,7 +21,7 @@ void GitBlob::Initialize (Handle target) { HandleScope scope; Local t = FunctionTemplate::New(New); - + constructor_template = Persistent::New(t); constructor_template->InstanceTemplate()->SetInternalFieldCount(1); constructor_template->SetClassName(String::NewSymbol("Blob")); @@ -105,13 +105,14 @@ Handle GitBlob::Lookup(const Arguments& args) { blob->Ref(); - eio_custom(EIO_Lookup, EIO_PRI_DEFAULT, EIO_AfterLookup, ar); - ev_ref(EV_DEFAULT_UC); + uv_work_t *req = new uv_work_t; + req->data = ar; + uv_queue_work(uv_default_loop(), req, EIO_Lookup, EIO_AfterLookup); return scope.Close( Undefined() ); } -void GitBlob::EIO_Lookup(eio_req* req) { +void GitBlob::EIO_Lookup(uv_work_t* req) { lookup_request* ar = static_cast(req->data); git_oid oid = ar->oid->GetValue(); @@ -119,9 +120,9 @@ void GitBlob::EIO_Lookup(eio_req* req) { } -int GitBlob::EIO_AfterLookup(eio_req* req) { +void GitBlob::EIO_AfterLookup(uv_work_t* req) { lookup_request* ar = static_cast(req->data); - ev_unref(EV_DEFAULT_UC); + delete req; ar->blob->Unref(); Local argv[1]; @@ -133,12 +134,10 @@ int GitBlob::EIO_AfterLookup(eio_req* req) { if(try_catch.HasCaught()) FatalException(try_catch); - + ar->callback.Dispose(); delete ar; - - return 0; } Handle GitBlob::RawContent(const Arguments& args) { @@ -151,7 +150,7 @@ Handle GitBlob::RawContent(const Arguments& args) { int bufferLength = rawSize; Buffer* buffer = Buffer::New(const_cast(contents.c_str()), bufferLength); - + Local fastBuffer; MAKE_FAST_BUFFER(buffer, fastBuffer); diff --git a/src/commit.cc b/src/commit.cc index d85a9b727..989360756 100755 --- a/src/commit.cc +++ b/src/commit.cc @@ -23,7 +23,7 @@ void GitCommit::Initialize(Handle target) { HandleScope scope; Local t = FunctionTemplate::New(New); - + constructor_template = Persistent::New(t); constructor_template->InstanceTemplate()->SetInternalFieldCount(1); constructor_template->SetClassName(String::NewSymbol("Commit")); @@ -140,13 +140,14 @@ Handle GitCommit::Lookup(const Arguments& args) { commit->Ref(); - eio_custom(EIO_Lookup, EIO_PRI_DEFAULT, EIO_AfterLookup, ar); - ev_ref(EV_DEFAULT_UC); + uv_work_t *req = new uv_work_t; + req->data = ar; + uv_queue_work(uv_default_loop(), req, EIO_Lookup, EIO_AfterLookup); return scope.Close( Undefined() ); } -void GitCommit::EIO_Lookup(eio_req *req) { +void GitCommit::EIO_Lookup(uv_work_t *req) { lookup_request *ar = static_cast(req->data); git_oid oid = ar->oid->GetValue(); @@ -154,11 +155,12 @@ void GitCommit::EIO_Lookup(eio_req *req) { } -int GitCommit::EIO_AfterLookup(eio_req *req) { +void GitCommit::EIO_AfterLookup(uv_work_t *req) { HandleScope scope; lookup_request *ar = static_cast(req->data); - ev_unref(EV_DEFAULT_UC); + delete req; + ar->commit->Unref(); Handle argv[1]; @@ -171,12 +173,10 @@ int GitCommit::EIO_AfterLookup(eio_req *req) { if(try_catch.HasCaught()) { FatalException(try_catch); } - + ar->callback.Dispose(); delete ar; - - return 0; } Handle GitCommit::Close(const Arguments& args) { @@ -184,7 +184,7 @@ Handle GitCommit::Close(const Arguments& args) { GitCommit *commit = ObjectWrap::Unwrap(args.This()); commit->Close(); - + return scope.Close( Undefined() ); } @@ -200,13 +200,13 @@ Handle GitCommit::Id(const Arguments& args) { GitOid *oid = ObjectWrap::Unwrap(args[0]->ToObject()); oid->SetValue(*const_cast(commit->Id())); - + return scope.Close( Undefined() ); } Handle GitCommit::MessageShort(const Arguments& args) { HandleScope scope; - + GitCommit *commit = ObjectWrap::Unwrap(args.This()); return scope.Close( String::New(commit->MessageShort()) ); @@ -214,7 +214,7 @@ Handle GitCommit::MessageShort(const Arguments& args) { Handle GitCommit::Message(const Arguments& args) { HandleScope scope; - + GitCommit *commit = ObjectWrap::Unwrap(args.This()); return scope.Close( String::New(commit->Message()) ); @@ -222,7 +222,7 @@ Handle GitCommit::Message(const Arguments& args) { Handle GitCommit::Time(const Arguments& args) { HandleScope scope; - + GitCommit *commit = ObjectWrap::Unwrap(args.This()); return scope.Close( Integer::New(commit->Time()) ); @@ -232,7 +232,7 @@ Handle GitCommit::TimeOffset(const Arguments& args) { HandleScope scope; GitCommit *commit = ObjectWrap::Unwrap(args.This()); - + return scope.Close( Integer::New(commit->TimeOffset()) ); } @@ -248,7 +248,7 @@ Handle GitCommit::Committer(const Arguments& args) { GitSig *sig = ObjectWrap::Unwrap(args[0]->ToObject()); sig->SetValue(const_cast(commit->Committer())); - + return scope.Close( Undefined() ); } @@ -264,7 +264,7 @@ Handle GitCommit::Author(const Arguments& args) { GitSig *sig = ObjectWrap::Unwrap(args[0]->ToObject()); sig->SetValue(const_cast(commit->Author())); - + return scope.Close( Undefined() ); } diff --git a/src/reference.cc b/src/reference.cc index 5a9f8e29b..ac824c3b4 100755 --- a/src/reference.cc +++ b/src/reference.cc @@ -19,7 +19,7 @@ void GitReference::Initialize(Handle target) { HandleScope scope; Local t = FunctionTemplate::New(New); - + constructor_template = Persistent::New(t); constructor_template->InstanceTemplate()->SetInternalFieldCount(1); constructor_template->SetClassName(String::NewSymbol("Ref")); @@ -87,13 +87,14 @@ Handle GitReference::Lookup(const Arguments& args) { ref->Ref(); - eio_custom(EIO_Lookup, EIO_PRI_DEFAULT, EIO_AfterLookup, ar); - ev_ref(EV_DEFAULT_UC); + uv_work_t *req = new uv_work_t; + req->data = ar; + uv_queue_work(uv_default_loop(), req, EIO_Lookup, EIO_AfterLookup); return scope.Close( Undefined() ); } -void GitReference::EIO_Lookup(eio_req *req) { +void GitReference::EIO_Lookup(uv_work_t *req) { lookup_request *ar = static_cast(req->data); git_repository* repo = ar->repo->GetValue(); @@ -102,11 +103,11 @@ void GitReference::EIO_Lookup(eio_req *req) { } -int GitReference::EIO_AfterLookup(eio_req *req) { +void GitReference::EIO_AfterLookup(uv_work_t *req) { HandleScope scope; lookup_request *ar = static_cast(req->data); - ev_unref(EV_DEFAULT_UC); + delete req; ar->ref->Unref(); Local argv[1]; @@ -118,12 +119,10 @@ int GitReference::EIO_AfterLookup(eio_req *req) { if(try_catch.HasCaught()) FatalException(try_catch); - + ar->callback.Dispose(); delete ar; - - return 0; } Handle GitReference::Oid(const Arguments& args) { diff --git a/src/repo.cc b/src/repo.cc index f44d41236..2a9b153f1 100755 --- a/src/repo.cc +++ b/src/repo.cc @@ -19,7 +19,7 @@ void GitRepo::Initialize(Handle target) { HandleScope scope; Local t = FunctionTemplate::New(New); - + constructor_template = Persistent::New(t); constructor_template->InstanceTemplate()->SetInternalFieldCount(1); constructor_template->SetClassName(String::NewSymbol("Repo")); @@ -94,24 +94,25 @@ Handle GitRepo::Open(const Arguments& args) { repo->Ref(); - eio_custom(EIO_Open, EIO_PRI_DEFAULT, EIO_AfterOpen, ar); - ev_ref(EV_DEFAULT_UC); + uv_work_t *req = new uv_work_t; + req->data = ar; + uv_queue_work(uv_default_loop(), req, EIO_Open, EIO_AfterOpen); return scope.Close( Undefined() ); } -void GitRepo::EIO_Open(eio_req *req) { +void GitRepo::EIO_Open(uv_work_t *req) { open_request *ar = static_cast(req->data); ar->err = ar->repo->Open(ar->path.c_str()); } -int GitRepo::EIO_AfterOpen(eio_req *req) { +void GitRepo::EIO_AfterOpen(uv_work_t *req) { HandleScope scope; open_request *ar = static_cast(req->data); - ev_unref(EV_DEFAULT_UC); + delete req; ar->repo->Unref(); Local argv[1]; @@ -123,12 +124,10 @@ int GitRepo::EIO_AfterOpen(eio_req *req) { if(try_catch.HasCaught()) FatalException(try_catch); - + ar->callback.Dispose(); delete ar; - - return 0; } Handle GitRepo::Lookup(const Arguments& args) { @@ -167,7 +166,7 @@ Handle GitRepo::Lookup(const Arguments& args) { return scope.Close( Undefined() ); } -int GitRepo::EIO_Lookup(eio_req *req) { +void GitRepo::EIO_Lookup(uv_work_t *req) { //lookup_request *ar = static_cast(req->data); // //String::Utf8Value name(ar->name); @@ -183,11 +182,11 @@ int GitRepo::EIO_Lookup(eio_req *req) { //return 0; } -int GitRepo::EIO_AfterLookup(eio_req *req) { +void GitRepo::EIO_AfterLookup(uv_work_t *req) { //HandleScope scope; //lookup_request *ar = static_cast(req->data); - //ev_unref(EV_DEFAULT_UC); + // delete req; //ar->repo->Unref(); //Local argv[1]; @@ -199,7 +198,7 @@ int GitRepo::EIO_AfterLookup(eio_req *req) { //if(try_catch.HasCaught()) // FatalException(try_catch); - // + // //ar->err.Dispose(); //ar->name.Dispose(); //ar->callback.Dispose(); @@ -250,24 +249,25 @@ Handle GitRepo::Init(const Arguments& args) { repo->Ref(); - eio_custom(EIO_Init, EIO_PRI_DEFAULT, EIO_AfterInit, ar); - ev_ref(EV_DEFAULT_UC); + uv_work_t *req = new uv_work_t; + req->data = ar; + uv_queue_work(uv_default_loop(), req, EIO_Init, EIO_AfterInit); return scope.Close( Undefined() ); } -void GitRepo::EIO_Init(eio_req *req) { +void GitRepo::EIO_Init(uv_work_t *req) { init_request *ar = static_cast(req->data); ar->err = ar->repo->Init(ar->path.c_str(), ar->is_bare); } -int GitRepo::EIO_AfterInit(eio_req *req) { +void GitRepo::EIO_AfterInit(uv_work_t *req) { HandleScope scope; init_request *ar = static_cast(req->data); - ev_unref(EV_DEFAULT_UC); + delete req; ar->repo->Unref(); Local argv[2]; @@ -279,11 +279,9 @@ int GitRepo::EIO_AfterInit(eio_req *req) { if(try_catch.HasCaught()) FatalException(try_catch); - + ar->callback.Dispose(); delete ar; - - return 0; } Persistent GitRepo::constructor_template; diff --git a/src/revwalk.cc b/src/revwalk.cc index 3715a601d..ec3f6163e 100755 --- a/src/revwalk.cc +++ b/src/revwalk.cc @@ -18,7 +18,7 @@ void GitRevWalk::Initialize(Handle target) { HandleScope scope; Local t = FunctionTemplate::New(New); - + constructor_template = Persistent::New(t); constructor_template->InstanceTemplate()->SetInternalFieldCount(1); constructor_template->SetClassName(String::NewSymbol("RevWalk")); @@ -119,7 +119,7 @@ Handle GitRevWalk::Push(const Arguments& args) { } GitOid *oid = ObjectWrap::Unwrap(args[0]->ToObject()); - + git_oid tmp = oid->GetValue(); int err = revwalk->Push(&tmp); @@ -149,13 +149,14 @@ Handle GitRevWalk::Next(const Arguments& args) { revwalk->Ref(); - eio_custom(EIO_Next, EIO_PRI_DEFAULT, EIO_AfterNext, ar); - ev_ref(EV_DEFAULT_UC); + uv_work_t *req = new uv_work_t; + req->data = ar; + uv_queue_work(uv_default_loop(), req, EIO_Next, EIO_AfterNext); return scope.Close( Undefined() ); } -void GitRevWalk::EIO_Next(eio_req *req) { +void GitRevWalk::EIO_Next(uv_work_t *req) { next_request *ar = static_cast(req->data); git_oid oid = ar->oid->GetValue(); @@ -164,11 +165,11 @@ void GitRevWalk::EIO_Next(eio_req *req) { } -int GitRevWalk::EIO_AfterNext(eio_req *req) { +void GitRevWalk::EIO_AfterNext(uv_work_t *req) { HandleScope scope; next_request *ar = static_cast(req->data); - ev_unref(EV_DEFAULT_UC); + delete req; ar->revwalk->Unref(); Local argv[1]; @@ -180,12 +181,10 @@ int GitRevWalk::EIO_AfterNext(eio_req *req) { if(try_catch.HasCaught()) FatalException(try_catch); - + ar->callback.Dispose(); delete ar; - - return 0; } Handle GitRevWalk::Free(const Arguments& args) { diff --git a/src/tree.cc b/src/tree.cc index fe3b1bdbf..6a985b967 100755 --- a/src/tree.cc +++ b/src/tree.cc @@ -19,7 +19,7 @@ void GitTree::Initialize (Handle target) { HandleScope scope; Local t = FunctionTemplate::New(New); - + constructor_template = Persistent::New(t); constructor_template->InstanceTemplate()->SetInternalFieldCount(1); constructor_template->SetClassName(String::NewSymbol("Tree")); @@ -113,7 +113,7 @@ Handle GitTree::Lookup(const Arguments& args) { // return scope.Close( Undefined() ); } -//int GitTree::EIO_Lookup(eio_req *req) { +//void GitTree::EIO_Lookup(uv_work_t *req) { // lookup_request *lr = static_cast(req->data); // // git_oid oid = lr->oid->GetValue(); @@ -122,7 +122,7 @@ Handle GitTree::Lookup(const Arguments& args) { // return 0; //} -//int GitTree::EIO_AfterLookup(eio_req *req) { +//void GitTree::EIO_AfterLookup(uv_work_t *req) { // lookup_request *lr = static_cast(req->data); // // ev_unref(EV_DEFAULT_UC); @@ -137,7 +137,7 @@ Handle GitTree::Lookup(const Arguments& args) { // // if(try_catch.HasCaught()) // FatalException(try_catch); -// +// // lr->callback.Dispose(); // // delete lr; @@ -151,7 +151,7 @@ Handle GitTree::EntryCount(const Arguments& args) { GitTree *tree = ObjectWrap::Unwrap(args.This()); int count = tree->EntryCount(); - + return scope.Close( Integer::New(count) ); } @@ -183,23 +183,24 @@ Handle GitTree::EntryByIndex(const Arguments& args) { tree->Ref(); - eio_custom(EIO_EntryByIndex, EIO_PRI_DEFAULT, EIO_AfterEntryByIndex, er); - ev_ref(EV_DEFAULT_UC); + uv_work_t *req = new uv_work_t; + req->data = er; + uv_queue_work(uv_default_loop(), req, EIO_EntryByIndex, EIO_AfterEntryByIndex); return scope.Close( Undefined() ); } -void GitTree::EIO_EntryByIndex(eio_req *req) { +void GitTree::EIO_EntryByIndex(uv_work_t *req) { entryindex_request *er = static_cast(req->data); er->entry->SetValue(er->tree->EntryByIndex(er->idx)); } -int GitTree::EIO_AfterEntryByIndex(eio_req *req) { +void GitTree::EIO_AfterEntryByIndex(uv_work_t *req) { entryindex_request *er = static_cast(req->data); - ev_unref(EV_DEFAULT_UC); + delete req; er->tree->Unref(); Handle argv[0]; @@ -210,12 +211,10 @@ int GitTree::EIO_AfterEntryByIndex(eio_req *req) { if(try_catch.HasCaught()) FatalException(try_catch); - + er->callback.Dispose(); delete er; - - return 0; } Handle GitTree::EntryByName(const Arguments& args) { @@ -248,23 +247,24 @@ Handle GitTree::EntryByName(const Arguments& args) { tree->Ref(); - eio_custom(EIO_EntryByName, EIO_PRI_DEFAULT, EIO_AfterEntryByName, er); - ev_ref(EV_DEFAULT_UC); + uv_work_t *req = new uv_work_t; + req->data = er; + uv_queue_work(uv_default_loop(), req, EIO_EntryByName, EIO_AfterEntryByName); return scope.Close( Undefined() ); } -void GitTree::EIO_EntryByName(eio_req *req) { +void GitTree::EIO_EntryByName(uv_work_t *req) { entryname_request *er = static_cast(req->data); er->entry->SetValue(er->tree->EntryByName(er->name.c_str())); } -int GitTree::EIO_AfterEntryByName(eio_req *req) { +void GitTree::EIO_AfterEntryByName(uv_work_t *req) { entryname_request *er = static_cast(req->data); - ev_unref(EV_DEFAULT_UC); + delete req; er->tree->Unref(); Handle argv[1]; @@ -276,12 +276,10 @@ int GitTree::EIO_AfterEntryByName(eio_req *req) { if(try_catch.HasCaught()) FatalException(try_catch); - + er->callback.Dispose(); delete er; - - return 0; } Handle GitTree::SortEntries(const Arguments& args) { @@ -290,7 +288,7 @@ Handle GitTree::SortEntries(const Arguments& args) { GitTree *tree = ObjectWrap::Unwrap(args.This()); int err = tree->SortEntries(); - + return scope.Close( Integer::New(err) ); } diff --git a/src/tree_entry.cc b/src/tree_entry.cc index 088ae8b82..bc35a78eb 100755 --- a/src/tree_entry.cc +++ b/src/tree_entry.cc @@ -19,7 +19,7 @@ using namespace node; void GitTreeEntry::Initialize(Handle target) { Local t = FunctionTemplate::New(New); - + constructor_template = Persistent::New(t); constructor_template->InstanceTemplate()->SetInternalFieldCount(1); constructor_template->SetClassName(String::NewSymbol("TreeEntry")); @@ -94,7 +94,7 @@ Handle GitTreeEntry::Id(const Arguments& args) { GitOid* oid = ObjectWrap::Unwrap(args[0]->ToObject()); oid->SetValue(*const_cast(entry->Id())); - + return scope.Close( Undefined() ); } @@ -118,7 +118,7 @@ Handle GitTreeEntry::ToObject(const Arguments& args) { entry->ToObject(repo->GetValue(), &out); object->SetValue(out); - + return scope.Close( Undefined() ); } Persistent GitTreeEntry::constructor_template; From 792da3c4fd008c738e14e5385a4f029e516409fe Mon Sep 17 00:00:00 2001 From: Michael Robinson Date: Tue, 26 Feb 2013 23:12:06 +1300 Subject: [PATCH 3/5] Updated contributors --- package.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/package.json b/package.json index aab2939ee..d13b25d19 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,12 @@ "version": "0.0.6", "homepage": "https://github.com/tbranyen/nodegit", "author": "Tim Branyen (http://twitter.com/tbranyen)", + "contributors": [ + { + "name": "Michael Robinson", + "email": "mike@pagesofinterest.net" + } + ], "main": "./lib/index.js", "repository": { "type": "git", From 6a9cea62ed5a1e801d2c352fc3c75f4e72e9b918 Mon Sep 17 00:00:00 2001 From: Michael Robinson Date: Wed, 27 Feb 2013 02:04:31 +1300 Subject: [PATCH 4/5] Fixed convenience-commit.js --- example/convenience-commit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/convenience-commit.js b/example/convenience-commit.js index 7d72ed3e4..0c858d385 100644 --- a/example/convenience-commit.js +++ b/example/convenience-commit.js @@ -8,7 +8,7 @@ git.repo( '../.git', function( err, repo ) { var history = commit.history(); history.on( 'commit', function() { - //console.log(arguments); + console.log(arguments); }); history.on( 'end', function( commits ) { @@ -16,7 +16,7 @@ git.repo( '../.git', function( err, repo ) { var tree = commits[0].tree(); // Synchronous - tree.walk(function( i, entry ) { + tree.walk().on('entry', function( i, entry ) { console.log( entry.content ); return false; }); From 5716e9757886eaf38d51c86b192258c960d9cfea Mon Sep 17 00:00:00 2001 From: Michael Robinson Date: Wed, 27 Feb 2013 09:33:28 +1300 Subject: [PATCH 5/5] Update example/convenience-commit.js --- example/convenience-commit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/convenience-commit.js b/example/convenience-commit.js index 0c858d385..235e39d04 100644 --- a/example/convenience-commit.js +++ b/example/convenience-commit.js @@ -8,7 +8,7 @@ git.repo( '../.git', function( err, repo ) { var history = commit.history(); history.on( 'commit', function() { - console.log(arguments); + // console.log(arguments); }); history.on( 'end', function( commits ) {