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

Commit b6600b7

Browse filesBrowse files
committed
Merge branch 'master' of github.com:nodegit/nodegit
2 parents 7822fac + 08c38b3 commit b6600b7
Copy full SHA for b6600b7

File tree

Expand file treeCollapse file tree

2 files changed

+12
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-8
lines changed
Open diff view settings
Collapse file

‎src/index.cc‎

Copy file name to clipboardExpand all lines: src/index.cc
+10-8Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -803,12 +803,6 @@ Handle<Value> GitIndex::IndexToWorkdir(const Arguments& args) {
803803
if (args.Length() == 0 || !args[0]->IsObject()) {
804804
return ThrowException(Exception::Error(String::New("Repository repo is required.")));
805805
}
806-
if (args.Length() == 1 || !args[1]->IsObject()) {
807-
return ThrowException(Exception::Error(String::New("Index index is required.")));
808-
}
809-
if (args.Length() == 2 || !args[2]->IsObject()) {
810-
return ThrowException(Exception::Error(String::New("DiffOptions opts is required.")));
811-
}
812806

813807
if (args.Length() == 3 || !args[3]->IsFunction()) {
814808
return ThrowException(Exception::Error(String::New("Callback is required and must be a Function.")));
@@ -824,12 +818,20 @@ Handle<Value> GitIndex::IndexToWorkdir(const Arguments& args) {
824818
baton->repo = from_repo;
825819
baton->indexReference = Persistent<Value>::New(args[1]);
826820
git_index * from_index;
821+
if (args[1]->IsObject()) {
827822
from_index = ObjectWrap::Unwrap<GitIndex>(args[1]->ToObject())->GetValue();
828-
baton->index = from_index;
823+
} else {
824+
from_index = 0;
825+
}
826+
baton->index = from_index;
829827
baton->optsReference = Persistent<Value>::New(args[2]);
830828
const git_diff_options * from_opts;
829+
if (args[2]->IsObject()) {
831830
from_opts = ObjectWrap::Unwrap<GitDiffOptions>(args[2]->ToObject())->GetValue();
832-
baton->opts = from_opts;
831+
} else {
832+
from_opts = 0;
833+
}
834+
baton->opts = from_opts;
833835
baton->callback = Persistent<Function>::New(Local<Function>::Cast(args[3]));
834836

835837
uv_queue_work(uv_default_loop(), &baton->request, IndexToWorkdirWork, (uv_after_work_cb)IndexToWorkdirAfterWork);
Collapse file

‎v0.18.0.json‎

Copy file name to clipboardExpand all lines: v0.18.0.json
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5439,13 +5439,15 @@
54395439
"cType": "git_index *",
54405440
"cppClassName": "GitIndex",
54415441
"jsClassName": "Index",
5442+
"isOptional": true,
54425443
"comment": "The index to diff from; repo index used if NULL."
54435444
},
54445445
{
54455446
"name": "opts",
54465447
"cType": "const git_diff_options *",
54475448
"cppClassName": "GitDiffOptions",
54485449
"jsClassName": "DiffOptions",
5450+
"isOptional": true,
54495451
"comment": "Structure with options to influence diff or NULL for defaults."
54505452
}
54515453
],

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.