Skip to content
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
1,206 changes: 946 additions & 260 deletions generate/input/descriptor.json

Large diffs are not rendered by default.

174 changes: 161 additions & 13 deletions generate/input/libgit2-supplement.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@
},
"group": "branch"
},
"git_clone": {
"isManual": true,
"cFile": "generate/templates/manual/clone/clone.cc",
"isAsync": true,
"isPrototypeMethod": false,
"group": "clone"
},
"git_commit_extract_signature": {
"args": [
{
Expand Down Expand Up @@ -144,6 +151,13 @@
"isErrorCode": true
}
},
"git_filter_list_load": {
"isManual": true,
"cFile": "generate/templates/manual/filter_list/load.cc",
"isAsync": true,
"isPrototypeMethod": false,
"group": "filter_list"
},
"git_patch_convenient_from_diff": {
"args": [
{
Expand Down Expand Up @@ -331,6 +345,16 @@
"git_annotated_commit_lookup"
]
],
[
"diff_stats",
[
"git_diff_stats_files_changed",
"git_diff_stats_insertions",
"git_diff_stats_deletions",
"git_diff_stats_to_buf",
"git_diff_stats_free"
]
],
[
"filter_list",
[
Expand All @@ -352,6 +376,12 @@
"git_filter_source_flags"
]
],
[
"merge_file_result",
[
"git_merge_file_result_free"
]
],
[
"odb_object",
[
Expand All @@ -363,12 +393,40 @@
"git_odb_object_type"
]
],
[
"odb_stream",
[
"git_odb_stream_finalize_write",
"git_odb_stream_free",
"git_odb_stream_read",
"git_odb_stream_write"
]
],
[
"oid_shorten",
[
"git_oid_shorten_add",
"git_oid_shorten_free",
"git_oid_shorten_new"
]
],
[
"patch",
[
"git_patch_convenient_from_diff"
]
],
[
"pathspec_match_list",
[
"git_pathspec_match_list_diff_entry",
"git_pathspec_match_list_entry",
"git_pathspec_match_list_entrycount",
"git_pathspec_match_list_failed_entry",
"git_pathspec_match_list_failed_entrycount",
"git_pathspec_match_list_free"
]
],
[
"reflog_entry",
[
Expand Down Expand Up @@ -486,6 +544,72 @@
]
}
],
[
"git_describe_format_options",
{
"type": "struct",
"fields": [
{
"type": "unsigned int",
"name": "version"
},
{
"type": "unsigned int",
"name": "abbreviated_size"
},
{
"type": "int",
"name": "always_use_long_format"
},
{
"type": "const char *",
"name": "dirty_suffix"
}
],
"used": {
"needs": [
"git_describe_init_format_options"
]
}
}
],
[
"git_describe_options",
{
"type": "struct",
"fields": [
{
"type": "unsigned int",
"name": "version"
},
{
"type": "unsigned int",
"name": "max_candidates_tags"
},
{
"type": "unsigned int",
"name": "describe_strategy"
},
{
"type": "const char *",
"name": "pattern"
},
{
"type": "int",
"name": "only_follow_first_parent"
},
{
"type": "int",
"name": "show_commit_oid_as_fallback"
}
],
"used": {
"needs": [
"git_describe_init_options"
]
}
}
],
[
"git_filter",
{
Expand Down Expand Up @@ -902,23 +1026,25 @@
"git_annotated_commit_lookup"
]
},
"filter": {
"diff": {
"functions": [
"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"
"git_diff_stats_files_changed",
"git_diff_stats_insertions",
"git_diff_stats_deletions",
"git_diff_stats_to_buf",
"git_diff_stats_free"
]
},
"merge": {
"functions": [
"git_merge_driver_lookup",
"git_merge_driver_register",
"git_merge_driver_source_ancestor",
"git_merge_driver_source_ours",
"git_merge_driver_source_repo",
"git_merge_driver_source_theirs",
"git_merge_driver_unregister",
"git_merge_file_result_free",
"git_merge_head_free",
"git_merge_head_from_fetchhead",
"git_merge_head_from_id",
Expand All @@ -938,7 +1064,28 @@
"git_odb_object_free",
"git_odb_object_id",
"git_odb_object_size",
"git_odb_object_type"
"git_odb_object_type",
"git_odb_stream_finalize_write",
"git_odb_stream_free",
"git_odb_stream_read",
"git_odb_stream_write"
]
},
"oid": {
"functions": [
"git_oid_shorten_add",
"git_oid_shorten_free",
"git_oid_shorten_new"
]
},
"pathspec": {
"functions": [
"git_pathspec_match_list_diff_entry",
"git_pathspec_match_list_entry",
"git_pathspec_match_list_entrycount",
"git_pathspec_match_list_failed_entry",
"git_pathspec_match_list_failed_entrycount",
"git_pathspec_match_list_free"
]
},
"reflog": {
Expand All @@ -959,6 +1106,7 @@
},
"tree": {
"functions": [
"git_tree_entry_dup",
"git_tree_entry_filemode",
"git_tree_entry_filemode_raw",
"git_tree_entry_free",
Expand Down
1 change: 1 addition & 0 deletions generate/templates/filters/fields_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = function(fields) {
fieldInfo.parsedName = field.name || "result";
fieldInfo.isCppClassIntType = ~["Uint32", "Int32"].indexOf(field.cppClassName);
fieldInfo.parsedClassName = (field.cppClassName || '').toLowerCase() + "_t";
fieldInfo.hasOwner = !fieldInfo.selfOwned && !!fieldInfo.ownedByThis;

result.push(fieldInfo);
});
Expand Down
51 changes: 51 additions & 0 deletions generate/templates/filters/returns_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,30 @@ module.exports = function(fn, argReturnsOnly, isAsync) {
var result = [];
var args = fn.args || [];

// We will use this to figure out the index
// of arguments, because sync functions
// need to respect ownership to an arbitrary
// parameter that is labeled by name in the
// descriptor, and we won't have access to
// any sort of string to argument index
// in the template.
var nameToArgIndex = {};
var thisArgName = '';
args.forEach(function (arg, index) {
nameToArgIndex[arg.name] = index;
if (arg.isSelf) {
thisArgName = arg.name;
}
});

args.forEach(function (arg) {
if (!arg.isReturn) return;

var return_info = {};

return_info.__proto__ = arg;

return_info.isAsync = isAsync;
return_info.parsedName = isAsync ? "baton->" + return_info.name : return_info.name;
return_info.isCppClassIntType = ~['Uint32', 'Int32'].indexOf(return_info.cppClassName);
return_info.needsDereference
Expand All @@ -21,6 +38,23 @@ module.exports = function(fn, argReturnsOnly, isAsync) {
return_info.returnNameOrName = return_info.returnName || return_info.name;
return_info.jsOrCppClassName = return_info.jsClassName || return_info.cppClassName;
return_info.isOutParam = true;
return_info.hasOwner = !return_info.selfOwned &&
!!(return_info.ownedBy || return_info.ownedByThis || return_info.ownerFn);
return_info.ownedByIndices = [];

if (isAsync && return_info.ownedByThis) {
return_info.ownedBy = return_info.ownedBy || [];
return_info.ownedBy.unshift(thisArgName);
}

// Here we convert ownedBy, which is the list of parameter names
// that own this result to the argument index.
// sync functions will need to know this.
if (!isAsync && return_info.ownedBy) {
return_info.ownedBy.forEach(function (argName) {
return_info.ownedByIndices.push(nameToArgIndex[return_info.ownedBy]);
})
}

result.push(return_info);
});
Expand All @@ -33,6 +67,23 @@ module.exports = function(fn, argReturnsOnly, isAsync) {
var return_info = {};

return_info.__proto__ = fn.return;

return_info.isAsync = isAsync;
return_info.hasOwner = !return_info.selfOwned &&
!!(return_info.ownedBy || return_info.ownedByThis || return_info.ownerFn);
return_info.ownedByIndices = [];
return_info.ownedBy = return_info.ownedBy || [];

if (return_info.ownedByThis && isAsync) {
return_info.ownedBy.push(thisArgName);
}

if (!isAsync) {
return_info.ownedByIndices = return_info.ownedBy.map(function (ownerName) {
return nameToArgIndex[ownerName];
});
}

return_info.parsedName = return_info.name && isAsync ? "baton->" + return_info.name : "result";
return_info.isCppClassIntType = ~['Uint32', 'Int32'].indexOf(return_info.cppClassName);
return_info.parsedClassName = (return_info.cppClassName || '').toLowerCase() + "_t";
Expand Down
Loading