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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions 96 generate/input/callbacks.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,102 @@
"error": -1
}
},
"git_filter_apply_fn": {
"args": [
{
"name": "self",
"cType": "git_filter *"
},
{
"name": "payload",
"cType": "void **"
},
{
"name": "to",
"cType": "git_buf *"
},
{
"name": "from",
"cType": "const git_buf *"
},
{
"name": "src",
"cType": "const git_filter_source *"
}
],
"return": {
"type": "int",
"noResults": -30,
"success": 0,
"error": -1
}
},
"git_filter_check_fn": {
"args": [
{
"name": "self",
"cType": "git_filter *"
},
{
"name": "payload",
"cType": "void **"
},
{
"name": "src",
"cType": "const git_filter_source *"
},
{
"name": "attr_values",
"cType": "const char **"
}
],
"return": {
"type": "int",
"noResults": -30,
"success": 0,
"error": -1
}
},
"git_filter_cleanup_fn": {
"args": [
{
"name": "self",
"cType": "git_filter *"
},
{
"name": "payload",
"cType": "void *"
}
],
"return": {
"type": "void"
}
},
"git_filter_init_fn": {
"args": [
{
"name": "self",
"cType": "git_filter *"
}
],
"return": {
"type": "int",
"noResults": 0,
"success": 0,
"error": -1
}
},
"git_filter_shutdown_fn": {
"args": [
{
"name": "self",
"cType": "git_filter *"
}
],
"return": {
"type": "void"
}
},
"git_index_matched_path_cb": {
"args": [
{
Expand Down
27 changes: 10 additions & 17 deletions 27 generate/input/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,8 @@
}
},
"filter": {
"selfFreeing": false,
"hasConstructor": true,
"functions": {
"git_filter_list_apply_to_blob": {
"ignore": true
Expand Down Expand Up @@ -920,30 +922,21 @@
"ignore": true
}
},
"cDependencies": [
"git2/sys/filter.h"
],
"fields": {
"initialize": {
"ignore": true
},
"shutdown": {
"ignore": true
},
"check": {
"ignore": true
},
"apply": {
"ignore": true
},
"cleanup": {
"stream": {
"ignore": true
}
},
}
},
"filter_source": {
"ignore": false,
"cDependencies": [
"git2/sys/filter.h"
]
},
"filter_source": {
"ignore": true
},
"graph": {
"functions": {
"git_graph_ahead_behind": {
Expand Down
67 changes: 45 additions & 22 deletions 67 generate/input/libgit2-supplement.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,17 @@
"git_annotated_commit_lookup"
]
],
[
"filter_source",
[
"git_filter_source_repo",
"git_filter_source_path",
"git_filter_source_filemode",
"git_filter_source_id",
"git_filter_source_mode",
"git_filter_source_flags"
]
],
[
"odb_object",
[
Expand Down Expand Up @@ -422,33 +433,23 @@
},
{
"type": "git_filter_init_fn",
"name": "initialize",
"ignore": true
"name": "initialize"
},
{
"type": "git_filter_shutdown_fn",
"name": "shutdown",
"ignore": true
"name": "shutdown"
},
{
"type": "git_filter_check_fn",
"name": "check",
"ignore": true
"name": "check"
},
{
"type": "git_filter_apply_fn",
"name": "apply",
"ignore": true
},
{
"type": "git_filter_stream_fn",
"name": "stream",
"ignore": true
"name": "apply"
},
{
"type": "git_filter_cleanup_fn",
"name": "cleanup",
"ignore": true
"name": "cleanup"
}
]
}
Expand Down Expand Up @@ -765,14 +766,26 @@
"git_annotated_commit_lookup"
]
},
"odb": {
"filter": {
"functions": [
"git_odb_object_data",
"git_odb_object_dup",
"git_odb_object_free",
"git_odb_object_id",
"git_odb_object_size",
"git_odb_object_type"
"git_filter_list_apply_to_blob",
"git_filter_list_apply_to_data",
"git_filter_list_apply_to_file",
"git_filter_list_contains",
"git_filter_list_free",
"git_filter_list_length",
"git_filter_list_load",
"git_filter_list_new",
"git_filter_list_push",
"git_filter_list_stream_blob",
"git_filter_list_stream_data",
"git_filter_list_stream_file",
"git_filter_source_filemode",
"git_filter_source_flags",
"git_filter_source_id",
"git_filter_source_mode",
"git_filter_source_path",
"git_filter_source_repo"
]
},
"merge": {
Expand All @@ -784,6 +797,16 @@
"git_merge_head_id"
]
},
"odb": {
"functions": [
"git_odb_object_data",
"git_odb_object_dup",
"git_odb_object_free",
"git_odb_object_id",
"git_odb_object_size",
"git_odb_object_type"
]
},
"reflog": {
"functions": [
"git_reflog_entry_committer",
Expand Down
10 changes: 9 additions & 1 deletion 10 generate/scripts/generateJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,18 @@ module.exports = function generateJson() {
}
};

var addSelfReferentialField = function(prop){
if (helpers.isSelfReferential(prop.type)) {
prop.isSelfReferential = true;
def.isExtendedStruct = true;
}
};

def.fields.forEach(addDependencies);
def.fields.forEach(addSelfReferentialField);
def.functions.forEach(addDependencies);


Object.keys(dependencies).forEach(function (dependencyFilename) {
def.dependencies.push("../include/" + dependencyFilename + ".h");
});
Expand All @@ -183,7 +192,6 @@ module.exports = function generateJson() {
fn.cppClassName = def.cppClassName;
});
});

// Process enums
_(enums).forEach(function(enumerable) {
output.some(function(obj) {
Expand Down
2 changes: 2 additions & 0 deletions 2 generate/scripts/generateNativeCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ module.exports = function generateNativeCode() {
replace: require("../templates/filters/replace"),
returnsCount: require("../templates/filters/returns_count"),
returnsInfo: require("../templates/filters/returns_info"),
subtract: require("../templates/filters/subtract"),
titleCase: require("../templates/filters/title_case"),
toBool: require('../templates/filters/to_bool'),
unPointer: require("../templates/filters/un_pointer"),
setUnsigned: require("../templates/filters/unsigned"),
upper: require("../templates/filters/upper")
};

Expand Down
7 changes: 6 additions & 1 deletion 7 generate/scripts/helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var callbackTypePattern = /\s*_cb/;
var callbackTypePattern = /\s*_(cb|fn)/,
selfReferentialTypePattern = /\s*_fn/;

var utils = require("./utils");
var _ = require("lodash");
Expand Down Expand Up @@ -93,6 +94,10 @@ var Helpers = {
&& ~cbField.name.indexOf(payloadName.replace("_payload", ""));
},

isSelfReferential: function(cType){
return selfReferentialTypePattern.test(cType);
},

getLibgitType: function(normalizedType, types) {
var libgitType;

Expand Down
8 changes: 2 additions & 6 deletions 8 generate/templates/filters/args_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ module.exports = function(args) {
jsArg++;
}

if (cArg === args.length -1) {
arg.lastArg = true;
}
else {
arg.lastArg = false;
}
arg.lastArg = cArg === args.length - 1;
arg.firstArg = !arg.lastArg && cArg === 0;

arg.cArg = cArg;
arg.isCppClassStringOrArray = ~["String", "Array"].indexOf(arg.cppClassName);
Expand Down
3 changes: 3 additions & 0 deletions 3 generate/templates/filters/subtract.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(value, other) {
return value - other;
};
3 changes: 3 additions & 0 deletions 3 generate/templates/filters/unsigned.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(value) {
return value < 0 ? 0 : value;
};
34 changes: 34 additions & 0 deletions 34 generate/templates/manual/include/async_baton.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,38 @@ struct AsyncBatonWithResult : public AsyncBaton {
}
};

struct AsyncBatonWithNoResult : public AsyncBaton {
void (*onCompletion)(AsyncBaton *);

void Done() {
if (onCompletion) {
onCompletion(this);
} else {
// signal completion
uv_sem_post(&semaphore);
}
}

void ExecuteAsync(ThreadPool::Callback asyncCallback, void (*onCompletion)(AsyncBaton *) = NULL) {
this->onCompletion = onCompletion;
if (!onCompletion) {
uv_sem_init(&semaphore, 0);
}

{
LockMaster::TemporaryUnlock temporaryUnlock;

libgit2ThreadPool.ExecuteReverseCallback(asyncCallback, this);

if (!onCompletion) {
// wait for completion
uv_sem_wait(&semaphore);
uv_sem_destroy(&semaphore);
}
}

return;
}
};

#endif
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.