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

Add `git_reset` and `git_reset_default` by johnhaley81 · Pull Request #415 · 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 .js  (3) .json  (2) All 2 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
32 changes: 32 additions & 0 deletions generate/input/descriptor.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 @@ -1413,6 +1413,38 @@
}
}
},
"reset": {
"functions": {
"git_reset": {
"args": {
"checkout_opts": {
"isOptional": true
},
"log_message": {
"isOptional": true
},
"signature": {
"isOptional": true
}
},
"isAsync": true,
"return": {
"isErrorCode": true
}
},
"git_reset_default": {
"args": {
"target": {
"isOptional": true
}
},
"isAsync": true,
"return": {
"isErrorCode": true
}
}
}
},
"revspec": {
"ignore": true
},
Expand Down
85 changes: 63 additions & 22 deletions generate/input/libgit2-supplement.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 @@ -107,6 +107,64 @@
}
},
"new" : {
"functions": {
"git_reset": {
"type": "function",
"file": "reset.h",
"args": [
{
"name": "repo",
"type": "git_repository *"
},
{
"name": "target",
"type": "git_object *"
},
{
"name": "reset_type",
"type": "git_reset_t"
},
{
"name": "checkout_opts",
"type": "git_checkout_options *"
},
{
"name": "signature",
"type": "const git_signature *"
},
{
"name": "log_message",
"type": "const char *"
}
],
"return": {
"type": "int"
},
"group": "reset"
}
},
"groups": [
[
"odb_object",
[
"git_odb_object_data",
"git_odb_object_dup",
"git_odb_object_free",
"git_odb_object_id",
"git_odb_object_size",
"git_odb_object_type"
]
],
[
"status_list",
[
"git_status_list_entrycount",
"git_status_list_free",
"git_status_list_get_perfdata",
"git_status_list_new"
]
]
],
"types": [
[
"git_direction",
Expand Down Expand Up @@ -340,28 +398,6 @@
}
}
]
],
"groups": [
[
"odb_object",
[
"git_odb_object_data",
"git_odb_object_dup",
"git_odb_object_free",
"git_odb_object_id",
"git_odb_object_size",
"git_odb_object_type"
]
],
[
"status_list",
[
"git_status_list_entrycount",
"git_status_list_free",
"git_status_list_get_perfdata",
"git_status_list_new"
]
]
]
},
"remove": {
Expand Down Expand Up @@ -392,5 +428,10 @@
"git_status_list_new"
]
}
},
"groups": {
"reset": [
"git_reset"
]
}
}
12 changes: 9 additions & 3 deletions generate/scripts/generateJson.js
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 @@ -11,16 +11,22 @@ var supplement = require("../input/libgit2-supplement.json");
module.exports = function generateJson() {
var helpers = require("./helpers");
_ = require("lodash");

// libgit2's docs aren't complete so we'll add in what they're missing here
libgit2.types.forEach(function(type) {
if (supplement.types[type[0]]){
if (supplement.types[type[0]]) {
_.merge(type[1], supplement.types[type[0]]);
}
});

// libgit2's docs aren't complete so we'll add in what they're missing here
libgit2.groups.forEach(function(group) {
if (supplement.groups[group[0]]) {
Array.prototype.push.apply(group[1], supplement.groups[group[0]]);
}
});

Array.prototype.push.apply(libgit2.types, supplement.new.types);
Array.prototype.push.apply(libgit2.groups, supplement.new.groups);
_.merge(libgit2.functions, supplement.new.functions);

var output = [];
var dependencyLookup = {};
Expand Down
30 changes: 30 additions & 0 deletions lib/reset.js
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
@@ -0,0 +1,30 @@
var NodeGit = require("../");
var normalizeOptions = require("./util/normalize_options");

var Reset = NodeGit.Reset;

var defaultFn = Reset.default;
Reset.default = function(repo, target, pathspecs) {
return defaultFn.call(this, repo, target, pathspecs);
};

var reset = Reset.reset;
Reset.reset = function( repo,
target,
resetType,
checkoutOpts,
signature,
logMessage) {
checkoutOpts = normalizeOptions(checkoutOpts, NodeGit.CheckoutOptions);

return reset.call(
this,
repo,
target,
resetType,
checkoutOpts,
signature,
logMessage);
};

module.exports = Reset;
Loading

Back | FazBrowse Home | New Git URL