Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
1 change: 1 addition & 0 deletions 1 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
/out
/test.git
/test/.reposCache
.idea
27 changes: 15 additions & 12 deletions 27 src/tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,6 @@ Handle<Value> GitTree::DiffIndex(const Arguments& args) {
if (args.Length() == 0 || !args[0]->IsObject()) {
return ThrowException(Exception::Error(String::New("Repository repo is required.")));
}
if (args.Length() == 1 || !args[1]->IsObject()) {
return ThrowException(Exception::Error(String::New("Index index is required.")));
}
if (args.Length() == 2 || !args[2]->IsObject()) {
return ThrowException(Exception::Error(String::New("DiffOptions opts is required.")));
}

if (args.Length() == 3 || !args[3]->IsFunction()) {
return ThrowException(Exception::Error(String::New("Callback is required and must be a Function.")));
Expand All @@ -458,12 +452,20 @@ Handle<Value> GitTree::DiffIndex(const Arguments& args) {
baton->old_tree = ObjectWrap::Unwrap<GitTree>(args.This())->GetValue();
baton->indexReference = Persistent<Value>::New(args[1]);
git_index * from_index;
if (args[1]->IsObject()) {
from_index = ObjectWrap::Unwrap<GitIndex>(args[1]->ToObject())->GetValue();
baton->index = from_index;
} else {
from_index = 0;
}
baton->index = from_index;
baton->optsReference = Persistent<Value>::New(args[2]);
const git_diff_options * from_opts;
if (args[2]->IsObject()) {
from_opts = ObjectWrap::Unwrap<GitDiffOptions>(args[2]->ToObject())->GetValue();
baton->opts = from_opts;
} else {
from_opts = 0;
}
baton->opts = from_opts;
baton->callback = Persistent<Function>::New(Local<Function>::Cast(args[3]));

uv_queue_work(uv_default_loop(), &baton->request, DiffIndexWork, (uv_after_work_cb)DiffIndexAfterWork);
Expand Down Expand Up @@ -536,9 +538,6 @@ Handle<Value> GitTree::DiffWorkDir(const Arguments& args) {
if (args.Length() == 0 || !args[0]->IsObject()) {
return ThrowException(Exception::Error(String::New("Repository repo is required.")));
}
if (args.Length() == 1 || !args[1]->IsObject()) {
return ThrowException(Exception::Error(String::New("DiffOptions opts is required.")));
}

if (args.Length() == 2 || !args[2]->IsFunction()) {
return ThrowException(Exception::Error(String::New("Callback is required and must be a Function.")));
Expand All @@ -556,8 +555,12 @@ Handle<Value> GitTree::DiffWorkDir(const Arguments& args) {
baton->old_tree = ObjectWrap::Unwrap<GitTree>(args.This())->GetValue();
baton->optsReference = Persistent<Value>::New(args[1]);
const git_diff_options * from_opts;
if (args[1]->IsObject()) {
from_opts = ObjectWrap::Unwrap<GitDiffOptions>(args[1]->ToObject())->GetValue();
baton->opts = from_opts;
} else {
from_opts = 0;
}
baton->opts = from_opts;
baton->callback = Persistent<Function>::New(Local<Function>::Cast(args[2]));

uv_queue_work(uv_default_loop(), &baton->request, DiffWorkDirWork, (uv_after_work_cb)DiffWorkDirAfterWork);
Expand Down
3 changes: 3 additions & 0 deletions 3 v0.18.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -17010,13 +17010,15 @@
"cType": "git_index *",
"cppClassName": "GitIndex",
"jsClassName": "Index",
"isOptional": true,
"comment": "The index to diff with; repo index used if NULL."
},
{
"name": "opts",
"cType": "const git_diff_options *",
"cppClassName": "GitDiffOptions",
"jsClassName": "DiffOptions",
"isOptional": true,
"comment": "Structure with options to influence diff or NULL for defaults."
}
],
Expand Down Expand Up @@ -17064,6 +17066,7 @@
"cType": "const git_diff_options *",
"cppClassName": "GitDiffOptions",
"jsClassName": "DiffOptions",
"isOptional": true,
"comment": "Structure with options to influence diff or NULL for defaults."
}
],
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.