Skip to content

Commit 1921175

Browse files
committed
Changed v0.18.0.json so diffWorkDir DiffOptions argument is optional. Added .idea to .gitignore to support webstorm.
1 parent b259162 commit 1921175

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
/out
1313
/test.git
1414
/test/.reposCache
15+
.idea

src/tree.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,6 @@ Handle<Value> GitTree::DiffWorkDir(const Arguments& args) {
536536
if (args.Length() == 0 || !args[0]->IsObject()) {
537537
return ThrowException(Exception::Error(String::New("Repository repo is required.")));
538538
}
539-
if (args.Length() == 1 || !args[1]->IsObject()) {
540-
return ThrowException(Exception::Error(String::New("DiffOptions opts is required.")));
541-
}
542539

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

563564
uv_queue_work(uv_default_loop(), &baton->request, DiffWorkDirWork, (uv_after_work_cb)DiffWorkDirAfterWork);

v0.18.0.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17064,6 +17064,7 @@
1706417064
"cType": "const git_diff_options *",
1706517065
"cppClassName": "GitDiffOptions",
1706617066
"jsClassName": "DiffOptions",
17067+
"isOptional": true,
1706717068
"comment": "Structure with options to influence diff or NULL for defaults."
1706817069
}
1706917070
],

0 commit comments

Comments
 (0)