| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -435,12 +435,6 @@ Handle<Value> GitTree::DiffIndex(const Arguments& args) { | |||
| 435 | 435 | if (args.Length() == 0 || !args[0]->IsObject()) { | |
| 436 | 436 | return ThrowException(Exception::Error(String::New("Repository repo is required."))); | |
| 437 | 437 | } | |
| 438 | - if (args.Length() == 1 || !args[1]->IsObject()) { | ||
| 439 | - return ThrowException(Exception::Error(String::New("Index index is required."))); | ||
| 440 | - } | ||
| 441 | - if (args.Length() == 2 || !args[2]->IsObject()) { | ||
| 442 | - return ThrowException(Exception::Error(String::New("DiffOptions opts is required."))); | ||
| 443 | - } | ||
| 444 | 438 | ||
| 445 | 439 | if (args.Length() == 3 || !args[3]->IsFunction()) { | |
| 446 | 440 | return ThrowException(Exception::Error(String::New("Callback is required and must be a Function."))); | |
@@ -458,12 +452,20 @@ Handle<Value> GitTree::DiffIndex(const Arguments& args) { | |||
| 458 | 452 | baton->old_tree = ObjectWrap::Unwrap<GitTree>(args.This())->GetValue(); | |
| 459 | 453 | baton->indexReference = Persistent<Value>::New(args[1]); | |
| 460 | 454 | git_index * from_index; | |
| 455 | + if (args[1]->IsObject()) { | ||
| 461 | 456 | from_index = ObjectWrap::Unwrap<GitIndex>(args[1]->ToObject())->GetValue(); | |
| 462 | - baton->index = from_index; | ||
| 457 | + } else { | ||
| 458 | + from_index = 0; | ||
| 459 | + } | ||
| 460 | + baton->index = from_index; | ||
| 463 | 461 | baton->optsReference = Persistent<Value>::New(args[2]); | |
| 464 | 462 | const git_diff_options * from_opts; | |
| 463 | + if (args[2]->IsObject()) { | ||
| 465 | 464 | from_opts = ObjectWrap::Unwrap<GitDiffOptions>(args[2]->ToObject())->GetValue(); | |
| 466 | - baton->opts = from_opts; | ||
| 465 | + } else { | ||
| 466 | + from_opts = 0; | ||
| 467 | + } | ||
| 468 | + baton->opts = from_opts; | ||
| 467 | 469 | baton->callback = Persistent<Function>::New(Local<Function>::Cast(args[3])); | |
| 468 | 470 | ||
| 469 | 471 | uv_queue_work(uv_default_loop(), &baton->request, DiffIndexWork, (uv_after_work_cb)DiffIndexAfterWork); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17010,13 +17010,15 @@ | |||
| 17010 | 17010 | "cType": "git_index *", | |
| 17011 | 17011 | "cppClassName": "GitIndex", | |
| 17012 | 17012 | "jsClassName": "Index", | |
| 17013 | + "isOptional": true, | ||
| 17013 | 17014 | "comment": "The index to diff with; repo index used if NULL." | |
| 17014 | 17015 | }, | |
| 17015 | 17016 | { | |
| 17016 | 17017 | "name": "opts", | |
| 17017 | 17018 | "cType": "const git_diff_options *", | |
| 17018 | 17019 | "cppClassName": "GitDiffOptions", | |
| 17019 | 17020 | "jsClassName": "DiffOptions", | |
| 17021 | + "isOptional": true, | ||
| 17020 | 17022 | "comment": "Structure with options to influence diff or NULL for defaults." | |
| 17021 | 17023 | } | |
| 17022 | 17024 | ], | |
| Back | FazBrowse Home | New Git URL |
0 commit comments