Skip to content

Commit eda3fae

Browse files
committed
Merge branch 'master' into gitkraken/use-libcurl-for-proxy
2 parents 95e54a7 + 8e431e9 commit eda3fae

39 files changed

+2334
-1458
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Change Log
22

3+
## <a name="v0-25-0-alpha-12" href="#v0-25-0-alpha-12">v0.25.0-alpha.12</a> [(2019-06-03)](https://github.com/nodegit/nodegit/releases/tag/v0.25.0-alpha.12)
4+
5+
[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.25.0-alpha.11...v0.25.0-alpha.12)
6+
7+
#### Summary of changes
8+
- Fix bug in Repository.prototype.refreshReferences where new remote references from a new remote added/fetched on a separte repo instance do not show up in the result.
9+
- Fixed a prototype problem with cherrypick, merge, and other collections that have a function at their root. call, apply, and bind should now be on NodeGit.Cherrypick.
10+
- Bumped libssh2 to resolve security notice.
11+
12+
#### Merged PRs into NodeGit
13+
- [Bump libssh2 to 1.8.2 and fix some npm audit warnings #1678](https://github.com/nodegit/nodegit/pull/1678)
14+
- [Root functions should keep their function prototypes correctly #1681](https://github.com/nodegit/nodegit/pull/1681)
15+
- [refresh_references.cc: bust LibGit2 remote list cache by reading config #1685](https://github.com/nodegit/nodegit/pull/1685)
16+
17+
318
## <a name="v0-25-0-alpha-11" href="#v0-25-0-alpha-11">v0.25.0-alpha.11</a> [(2019-05-20)](https://github.com/nodegit/nodegit/releases/tag/v0.25.0-alpha.11)
419

520
[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.25.0-alpha.10...v0.25.0-alpha.11)

generate/input/descriptor.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3408,6 +3408,7 @@
34083408
],
34093409
"functions": {
34103410
"git_reset": {
3411+
"isCollectionRoot": true,
34113412
"args": {
34123413
"checkout_opts": {
34133414
"isOptional": true

generate/scripts/generateNativeCode.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ module.exports = function generateNativeCode() {
5757
cppToV8: require("../templates/filters/cpp_to_v8"),
5858
defaultValue: require("../templates/filters/default_value"),
5959
fieldsInfo: require("../templates/filters/fields_info"),
60+
getCPPFunctionForRootProto: require("../templates/filters/get_cpp_function_for_root_proto"),
61+
hasFunctionOnRootProto: require("../templates/filters/has_function_on_root_proto"),
6062
hasReturnType: require("../templates/filters/has_return_type"),
6163
hasReturnValue: require("../templates/filters/has_return_value"),
6264
isArrayType: require("../templates/filters/is_array_type"),
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = function(functions) {
2+
if (!functions || functions.length === 0) {
3+
throw new Error("Should not be able to get function from empty function list");
4+
}
5+
6+
const fun = functions.find(function(f) { return f.useAsOnRootProto; });
7+
if (!fun) {
8+
throw new Error("There is no function on the root prototype for this collection");
9+
}
10+
11+
return fun.cppFunctionName;
12+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = function(functions) {
2+
if (!functions || functions.length === 0) {
3+
return false;
4+
}
5+
6+
return functions.some(function(f) { return f.useAsOnRootProto; });
7+
};

generate/templates/manual/repository/refresh_references.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,17 @@ void GitRepository::RefreshReferencesWorker::Execute()
415415
git_odb *odb;
416416

417417
baton->error_code = git_repository_odb(&odb, repo);
418+
if (baton->error_code != GIT_OK) {
419+
if (giterr_last() != NULL) {
420+
baton->error = git_error_dup(giterr_last());
421+
}
422+
delete refreshData;
423+
baton->out = NULL;
424+
return;
425+
}
426+
427+
git_config *config;
428+
baton->error_code = git_repository_config_snapshot(&config, repo);
418429
if (baton->error_code != GIT_OK) {
419430
if (giterr_last() != NULL) {
420431
baton->error = git_error_dup(giterr_last());
@@ -424,6 +435,8 @@ void GitRepository::RefreshReferencesWorker::Execute()
424435
baton->out = NULL;
425436
return;
426437
}
438+
git_config_free(config);
439+
427440

428441
// START Refresh HEAD
429442
git_reference *headRef = NULL;

generate/templates/templates/class_content.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,27 @@ using namespace node;
7979
void {{ cppClassName }}::InitializeComponent(v8::Local<v8::Object> target) {
8080
Nan::HandleScope scope;
8181

82-
v8::Local<Object> object = Nan::New<Object>();
82+
{% if functions|hasFunctionOnRootProto %}
83+
v8::Local<FunctionTemplate> object = Nan::New<FunctionTemplate>({{ functions|getCPPFunctionForRootProto }});
84+
{% else %}
85+
v8::Local<Object> object = Nan::New<Object>();
86+
{% endif %}
8387

8488
{% each functions as function %}
8589
{% if not function.ignore %}
8690
Nan::SetMethod(object, "{{ function.jsFunctionName }}", {{ function.cppFunctionName }});
8791
{% endif %}
8892
{% endeach %}
8993

90-
Nan::Set(target, Nan::New<String>("{{ jsClassName }}").ToLocalChecked(), object);
94+
Nan::Set(
95+
target,
96+
Nan::New("{{ jsClassName }}").ToLocalChecked(),
97+
{% if functions|hasFunctionOnRootProto %}
98+
Nan::GetFunction(object).ToLocalChecked()
99+
{% else %}
100+
object
101+
{% endif %}
102+
);
91103
}
92104

93105
{% endif %}

0 commit comments

Comments
 (0)