FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Changed v0.18.0.json so diffWorkDir DiffOptions argument is optional. Ad... by kmctown · Pull Request #103 · nodegit/nodegit · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cc  (1) .json  (1) dotfile  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 1 addition & 0 deletions .gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 src/tree.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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 v0.18.0.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL