Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions generate/input/libgit2-supplement.json
Original file line number Diff line number Diff line change
Expand Up @@ -2444,12 +2444,6 @@
}
}
],
[
"git_time_t",
{
"type": "enum"
}
],
[
"git_trace_level_t",
{
Expand Down
3 changes: 2 additions & 1 deletion generate/scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ var cTypeMappings = {
"uint32_t": "Number",
"uint64_t": "Number",
"double": "Number",
"git_object_size_t": "Number"
"git_object_size_t": "Number",
"git_time_t": "Number",
}

var collisionMappings = {
Expand Down
4 changes: 2 additions & 2 deletions generate/templates/manual/filter_source/repo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ NAN_METHOD(GitFilterSource::Repo) {

baton->error_code = GIT_OK;
baton->error = NULL;
baton->src = Nan::ObjectWrap::Unwrap<GitFilterSource>(info.This())->GetValue();
baton->src = Nan::ObjectWrap::Unwrap<GitFilterSource>(info.Holder())->GetValue();

Nan::Callback *callback = new Nan::Callback(v8::Local<Function>::Cast(info[info.Length() - 1]));
std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> cleanupHandles;
RepoWorker *worker = new RepoWorker(baton, callback, cleanupHandles);

worker->Reference<GitFilterSource>("src", info.This());
worker->Reference<GitFilterSource>("src", info.Holder());

nodegit::Context *nodegitContext = reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace nodegit {

virtual ~ConfigurableClassWrapper() {
if (raw != nullptr) {
delete raw;
free(raw);
raw = nullptr;
}
}
Expand Down
4 changes: 2 additions & 2 deletions generate/templates/manual/remote/ls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ NAN_METHOD(GitRemote::ReferenceList)
baton->error_code = GIT_OK;
baton->error = NULL;
baton->out = new std::vector<git_remote_head*>;
baton->remote = Nan::ObjectWrap::Unwrap<GitRemote>(info.This())->GetValue();
baton->remote = Nan::ObjectWrap::Unwrap<GitRemote>(info.Holder())->GetValue();

Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[info.Length() - 1]));
std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> cleanupHandles;
ReferenceListWorker *worker = new ReferenceListWorker(baton, callback, cleanupHandles);
worker->Reference<GitRemote>("remote", info.This());
worker->Reference<GitRemote>("remote", info.Holder());
nodegit::Context *nodegitContext = reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
return;
Expand Down
4 changes: 2 additions & 2 deletions generate/templates/manual/repository/get_references.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ NAN_METHOD(GitRepository::GetReferences)
baton->error_code = GIT_OK;
baton->error = NULL;
baton->out = new std::vector<git_reference *>;
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info.This())->GetValue();
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info.Holder())->GetValue();

Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[info.Length() - 1]));
std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> cleanupHandles;
GetReferencesWorker *worker = new GetReferencesWorker(baton, callback, cleanupHandles);
worker->Reference<GitRepository>("repo", info.This());
worker->Reference<GitRepository>("repo", info.Holder());
nodegit::Context *nodegitContext = reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
return;
Expand Down
4 changes: 2 additions & 2 deletions generate/templates/manual/repository/get_remotes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ NAN_METHOD(GitRepository::GetRemotes)
baton->error_code = GIT_OK;
baton->error = NULL;
baton->out = new std::vector<git_remote *>;
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info.This())->GetValue();
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info.Holder())->GetValue();

Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[info.Length() - 1]));
std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> cleanupHandles;
GetRemotesWorker *worker = new GetRemotesWorker(baton, callback, cleanupHandles);
worker->Reference<GitRepository>("repo", info.This());
worker->Reference<GitRepository>("repo", info.Holder());
nodegit::Context *nodegitContext = reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
return;
Expand Down
4 changes: 2 additions & 2 deletions generate/templates/manual/repository/get_submodules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ NAN_METHOD(GitRepository::GetSubmodules)
baton->error_code = GIT_OK;
baton->error = NULL;
baton->out = new std::vector<git_submodule *>;
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info.This())->GetValue();
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info.Holder())->GetValue();

Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[info.Length() - 1]));
std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> cleanupHandles;
GetSubmodulesWorker *worker = new GetSubmodulesWorker(baton, callback, cleanupHandles);
worker->Reference<GitRepository>("repo", info.This());
worker->Reference<GitRepository>("repo", info.Holder());
nodegit::Context *nodegitContext = reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
return;
Expand Down
18 changes: 9 additions & 9 deletions generate/templates/manual/repository/refresh_references.cc
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ class RefreshedRefModel {
}

~RefreshedRefModel() {
if (fullName != NULL) { delete[] fullName; }
if (message != NULL) { delete[] message; }
if (fullName != NULL) { free(fullName); }
if (message != NULL) { free(message); }
delete[] sha;
if (shorthand != NULL) { delete[] shorthand; }
if (shorthand != NULL) { free(shorthand); }
if (tagOdbBuffer != NULL) { delete[] tagOdbBuffer; }
}

Expand Down Expand Up @@ -344,8 +344,8 @@ class UpstreamModel {
}

~UpstreamModel() {
if (downstreamFullName != NULL) { delete[] downstreamFullName; }
if (upstreamFullName != NULL) { delete[] upstreamFullName; }
if (downstreamFullName != NULL) { free(downstreamFullName); }
if (upstreamFullName != NULL) { free(upstreamFullName); }
}

char *downstreamFullName;
Expand Down Expand Up @@ -375,7 +375,7 @@ class RefreshReferencesData {
delete upstreamInfo.back();
upstreamInfo.pop_back();
}
if (headRefFullName != NULL) { delete[] headRefFullName; }
if (headRefFullName != NULL) { free(headRefFullName); }
if (cherrypick != NULL) { delete cherrypick; }
if (merge != NULL) { delete merge; }
}
Expand Down Expand Up @@ -416,12 +416,12 @@ NAN_METHOD(GitRepository::RefreshReferences)
baton->error_code = GIT_OK;
baton->error = NULL;
baton->out = (void *)new RefreshReferencesData();
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info.This())->GetValue();
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info.Holder())->GetValue();

Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[info.Length() - 1]));
std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> cleanupHandles;
RefreshReferencesWorker *worker = new RefreshReferencesWorker(baton, callback, cleanupHandles);
worker->Reference<GitRepository>("repo", info.This());
worker->Reference<GitRepository>("repo", info.Holder());
worker->Reference("signatureType", signatureType);
nodegit::Context *nodegitContext = reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
Expand Down Expand Up @@ -573,7 +573,7 @@ void GitRepository::RefreshReferencesWorker::Execute()
if (isRemote) {
char *remoteNameOfRef = getRemoteNameOfReference(reference);
bool isFromExistingRemote = gitStrArrayContains(&remoteNames, remoteNameOfRef);
delete[] remoteNameOfRef;
free(remoteNameOfRef);
if (!isFromExistingRemote) {
git_reference_free(reference);
continue;
Expand Down
4 changes: 2 additions & 2 deletions generate/templates/manual/repository/statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1781,13 +1781,13 @@ NAN_METHOD(GitRepository::Statistics)

baton->error_code = GIT_OK;
baton->error = NULL;
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info.This())->GetValue();
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info.Holder())->GetValue();
baton->out = static_cast<void *>(new RepoAnalysis(baton->repo));

Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[info.Length() - 1]));
std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> cleanupHandles;
StatisticsWorker *worker = new StatisticsWorker(baton, callback, cleanupHandles);
worker->Reference<GitRepository>("repo", info.This());
worker->Reference<GitRepository>("repo", info.Holder());
nodegit::Context *nodegitContext =
reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
Expand Down
4 changes: 2 additions & 2 deletions generate/templates/manual/revwalk/commit_walk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ NAN_METHOD(GitRevwalk::CommitWalk) {
} else {
baton->returnPlainObjects = false;
}
baton->walk = Nan::ObjectWrap::Unwrap<GitRevwalk>(info.This())->GetValue();
baton->walk = Nan::ObjectWrap::Unwrap<GitRevwalk>(info.Holder())->GetValue();
Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[info.Length() - 1]));
std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> cleanupHandles;
CommitWalkWorker *worker = new CommitWalkWorker(baton, callback, cleanupHandles);
worker->Reference<GitRevwalk>("commitWalk", info.This());
worker->Reference<GitRevwalk>("commitWalk", info.Holder());

nodegit::Context *nodegitContext = reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
Expand Down
4 changes: 2 additions & 2 deletions generate/templates/manual/revwalk/fast_walk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ NAN_METHOD(GitRevwalk::FastWalk)
baton->max_count = Nan::To<unsigned int>(info[0]).FromJust();
baton->out = new std::vector<git_oid*>;
baton->out->reserve(baton->max_count);
baton->walk = Nan::ObjectWrap::Unwrap<GitRevwalk>(info.This())->GetValue();
baton->walk = Nan::ObjectWrap::Unwrap<GitRevwalk>(info.Holder())->GetValue();

Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[info.Length() - 1]));
std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> cleanupHandles;
FastWalkWorker *worker = new FastWalkWorker(baton, callback, cleanupHandles);
worker->Reference<GitRevwalk>("fastWalk", info.This());
worker->Reference<GitRevwalk>("fastWalk", info.Holder());

nodegit::Context *nodegitContext = reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
Expand Down
12 changes: 10 additions & 2 deletions generate/templates/manual/revwalk/file_history_walk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ class FileHistoryEvent {
if (commit != NULL) {
git_commit_free(commit);
}

if(from != NULL) {
free((void *)from);
}

if(to != NULL) {
free((void *)to);
}
}

v8::Local<v8::Value> toJavascript() {
Expand Down Expand Up @@ -206,12 +214,12 @@ NAN_METHOD(GitRevwalk::FileHistoryWalk)
baton->max_count = Nan::To<unsigned int>(info[1]).FromJust();
baton->out = new std::vector<void *>;
baton->out->reserve(baton->max_count);
baton->walk = Nan::ObjectWrap::Unwrap<GitRevwalk>(info.This())->GetValue();
baton->walk = Nan::ObjectWrap::Unwrap<GitRevwalk>(info.Holder())->GetValue();

Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[info.Length() - 1]));
std::map<std::string, std::shared_ptr<nodegit::CleanupHandle>> cleanupHandles;
FileHistoryWalkWorker *worker = new FileHistoryWalkWorker(baton, callback, cleanupHandles);
worker->Reference<GitRevwalk>("fileHistoryWalk", info.This());
worker->Reference<GitRevwalk>("fileHistoryWalk", info.Holder());

nodegit::Context *nodegitContext = reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
Expand Down
6 changes: 2 additions & 4 deletions generate/templates/manual/src/context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace nodegit {
: isolate(isolate)
, threadPool(10, node::GetCurrentEventLoop(isolate), this)
{
Nan::HandleScope scopoe;
Nan::HandleScope scope;
v8::Local<v8::Object> storage = Nan::New<v8::Object>();
persistentStorage.Reset(storage);
contexts[isolate] = this;
Expand All @@ -45,9 +45,7 @@ namespace nodegit {
}

Context *Context::GetCurrentContext() {
Nan::HandleScope scope;
v8::Local<v8::Context> context = Nan::GetCurrentContext();
v8::Isolate *isolate = context->GetIsolate();
v8::Isolate *isolate = v8::Isolate::GetCurrent();
return contexts[isolate];
}

Expand Down
22 changes: 11 additions & 11 deletions generate/templates/manual/src/convenient_hunk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ NAN_METHOD(ConvenientHunk::JSNewFunction) {
}

ConvenientHunk* object = new ConvenientHunk(static_cast<HunkData *>(Local<External>::Cast(info[0])->Value()));
object->Wrap(info.This());
object->Wrap(info.Holder());

info.GetReturnValue().Set(info.This());
info.GetReturnValue().Set(info.Holder());
}

Local<v8::Value> ConvenientHunk::New(void *raw) {
Expand All @@ -87,7 +87,7 @@ size_t ConvenientHunk::GetSize() {

NAN_METHOD(ConvenientHunk::Size) {
Local<v8::Value> to;
to = Nan::New<Number>(Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.This())->GetSize());
to = Nan::New<Number>(Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.Holder())->GetSize());
info.GetReturnValue().Set(to);
}

Expand All @@ -98,14 +98,14 @@ NAN_METHOD(ConvenientHunk::Lines) {

LinesBaton *baton = new LinesBaton();

baton->hunk = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.This())->GetValue();
baton->hunk = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.Holder())->GetValue();
baton->lines = new std::vector<git_diff_line *>;
baton->lines->reserve(baton->hunk->numLines);

Nan::Callback *callback = new Nan::Callback(Local<Function>::Cast(info[0]));
LinesWorker *worker = new LinesWorker(baton, callback);

worker->Reference<ConvenientHunk>("hunk", info.This());
worker->Reference<ConvenientHunk>("hunk", info.Holder());

nodegit::Context *nodegitContext = reinterpret_cast<nodegit::Context *>(info.Data().As<External>()->Value());
nodegitContext->QueueWorker(worker);
Expand Down Expand Up @@ -160,39 +160,39 @@ void ConvenientHunk::LinesWorker::HandleOKCallback() {

NAN_METHOD(ConvenientHunk::OldStart) {
Local<v8::Value> to;
int old_start = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.This())->GetValue()->hunk.old_start;
int old_start = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.Holder())->GetValue()->hunk.old_start;
info.GetReturnValue().Set(Nan::New<Number>(old_start));
}


NAN_METHOD(ConvenientHunk::OldLines) {
Local<v8::Value> to;
int old_lines = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.This())->GetValue()->hunk.old_lines;
int old_lines = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.Holder())->GetValue()->hunk.old_lines;
info.GetReturnValue().Set(Nan::New<Number>(old_lines));
}

NAN_METHOD(ConvenientHunk::NewStart) {
Local<v8::Value> to;
int new_start = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.This())->GetValue()->hunk.new_start;
int new_start = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.Holder())->GetValue()->hunk.new_start;
info.GetReturnValue().Set(Nan::New<Number>(new_start));
}

NAN_METHOD(ConvenientHunk::NewLines) {
Local<v8::Value> to;
int new_lines = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.This())->GetValue()->hunk.new_lines;
int new_lines = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.Holder())->GetValue()->hunk.new_lines;
info.GetReturnValue().Set(Nan::New<Number>(new_lines));
}

NAN_METHOD(ConvenientHunk::HeaderLen) {
Local<v8::Value> to;
size_t header_len = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.This())->GetValue()->hunk.header_len;
size_t header_len = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.Holder())->GetValue()->hunk.header_len;
info.GetReturnValue().Set(Nan::New<Number>(header_len));
}

NAN_METHOD(ConvenientHunk::Header) {
Local<v8::Value> to;

char *header = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.This())->GetValue()->hunk.header;
char *header = Nan::ObjectWrap::Unwrap<ConvenientHunk>(info.Holder())->GetValue()->hunk.header;
if (header) {
to = Nan::New<String>(header).ToLocalChecked();
} else {
Expand Down
Loading