Commit 29971257 authored by Tyler Wanek-test-test's avatar Tyler Wanek-test-test Committed by Tyler Wanek

worked on clone to update code to new libgit2 version

parent 9e3fcdca
......@@ -328,6 +328,18 @@
"error": -1
}
},
"git_odb_foreach_cb": {
"args": [
{
"name": "id",
"cType": "const git_oid *"
},
{
"name": "payload",
"cType": "void *"
}
]
},
"git_packbuilder_foreach_cb": {
"args": [
{
......@@ -350,6 +362,64 @@
"error": -1
}
},
"git_remote_create_cb": {
"args": [
{
"name": "out",
"cType": "git_repository **",
"isReturn": true
},
{
"name": "repo",
"cType": "git_repository *"
},
{
"name": "name",
"cType": "const char *"
},
{
"name": "url",
"cType": "const char *"
},
{
"name": "payload",
"cType": "void *"
}
],
"return": {
"type": "int",
"noResults": 0,
"success": 0,
"error": 1
}
},
"git_repository_create_cb": {
"args": [
{
"name": "out",
"cType": "git_repository **",
"isReturn": true
},
{
"name": "path",
"cType": "const char *"
},
{
"name": "bare",
"cType": "int"
},
{
"name": "payload",
"cType": "void *"
}
],
"return": {
"type": "int",
"noResults": 0,
"success": 0,
"error": 1
}
},
"git_reference_foreach_cb": {
"args": [
{
......@@ -452,6 +522,29 @@
"error": -1
}
},
"git_smart_subtransport_cb": {
"args": [
{
"name": "out",
"cType": "git_smart_subtransport **",
"isReturn": true
},
{
"name": "owner",
"cType": "git_transport*"
},
{
"name": "param",
"cType": "void *"
}
],
"return": {
"type": "int",
"noResults": 0,
"success": 0,
"error": -1
}
},
"git_stash_cb": {
"args": [
{
......
......@@ -391,6 +391,9 @@
"git_config_delete_multivar": {
"ignore": true
},
"git_config_entry_free": {
"ignore": true
},
"git_config_find_global": {
"ignore": true
},
......@@ -433,6 +436,12 @@
"isErrorCode": true
}
},
"git_config_get_string_buf": {
"ignore": true
},
"git_config_get_path": {
"ignore": true
},
"git_config_iterator_free": {
"ignore": true
},
......@@ -481,6 +490,9 @@
"git_config_parse_int64": {
"ignore": true
},
"git_config_parse_path": {
"ignore": true
},
"git_config_refresh": {
"ignore": true
},
......@@ -1646,9 +1658,6 @@
"sideband_progress": {
"ignore": true
},
"transport": {
"ignore": true
},
"update_tips": {
"ignore": true
}
......
......@@ -374,7 +374,8 @@
],
"used": {
"needs": [
"git_fetch_init_options"
"git_fetch_init_options",
"git_remote_init_callbacks"
]
}
}
......@@ -485,6 +486,48 @@
"type": "enum"
}
],
[
"git_remote_callbacks",
{
"type": "struct",
"fields": [
{
"type": "unsigned int",
"name": "version"
},
{
"type": "git_transport_message_cb",
"name": "sideband_progress"
},
{
"type": "git_cred_acquire_cb",
"name": "credentials"
},
{
"type": "git_transport_certificate_check_cb",
"name": "certificate_check"
},
{
"type": "git_transfer_progress_cb",
"name": "transfer_progress"
},
{
"type": "git_transport_cb",
"name": "transport",
"ignore": true
},
{
"type": "void *",
"name": "payload"
}
],
"used": {
"needs": [
"git_remote_init_callbacks"
]
}
}
],
[
"git_sort_t",
{
......
......@@ -116,7 +116,9 @@
NanScope();
{{ field.name|titleCase }}Baton* baton = static_cast<{{ field.name|titleCase }}Baton*>(req->data);
{{ cppClassName }}* instance = static_cast<{{ cppClassName }}*>(baton->payload);
{{ cppClassName }}* instance = static_cast<{{ cppClassName }}*>(baton->{% each field.args|argsInfo as arg %}
{% if arg.payload == true %}{{arg.name}}{% elsif arg.lastArg %}{{arg.name}}{% endif %}
{% endeach %});
if (instance->{{ field.name }}->IsEmpty()) {
{% if field.return.type == "int" %}
......
......@@ -15,21 +15,32 @@ var clone = Clone.clone;
* @return {Repository} repo
*/
Clone.clone = function(url, local_path, options) {
var remoteCallbacks;
var remoteCallbacks = {};
var fetchOpts = {};
if (options) {
options = shallowClone(options);
remoteCallbacks = options.remoteCallbacks;
delete options.remoteCallbacks;
if (options.fetchOpts) {
fetchOpts = shallowClone(options.fetchOpts);
}
delete options.fetchOpts;
}
options = normalizeOptions(options, NodeGit.CloneOptions);
if (remoteCallbacks) {
options.remoteCallbacks =
normalizeOptions(remoteCallbacks, NodeGit.RemoteCallbacks);
if (fetchOpts.callbacks) {
remoteCallbacks = shallowClone(fetchOpts.callbacks);
delete fetchOpts.callbacks;
}
fetchOpts = normalizeOptions(fetchOpts, NodeGit.FetchOptions);
fetchOpts.callbacks =
normalizeOptions(remoteCallbacks, NodeGit.RemoteCallbacks);
options.fetchOpts = fetchOpts;
// This is required to clean up after the clone to avoid file locking
// issues in Windows and potentially other issues we don't know about.
var freeRepository = function(repository) {
......
......@@ -33,7 +33,7 @@ Object.defineProperty(Repository.prototype, "openIndex", {
* @return {Ref}
*/
Repository.prototype.createBranch =
function(name, commit, force, signature, logMessage) {
function(name, commit, force) {
var repo = this;
if (commit instanceof Commit) {
......@@ -41,9 +41,7 @@ function(name, commit, force, signature, logMessage) {
repo,
name,
commit,
force ? 1 : 0,
signature,
logMessage);
force ? 1 : 0);
}
else {
return repo.getCommit(commit).then(function(commit) {
......@@ -51,9 +49,7 @@ function(name, commit, force, signature, logMessage) {
repo,
name,
commit,
force ? 1 : 0,
signature,
logMessage);
force ? 1 : 0);
});
}
};
......@@ -1050,8 +1046,9 @@ Repository.prototype.checkoutBranch = function(branch, opts) {
var repo = this;
var reference;
opts = opts || {};
opts.checkoutStrategy = opts.checkoutStrategy ||
Checkout.STRATEGY.SAFE_CREATE;
Checkout.STRATEGY.SAFE;
return repo.getReference(branch)
.then(function(ref) {
if (!ref.isBranch()) {
......@@ -1068,9 +1065,7 @@ Repository.prototype.checkoutBranch = function(branch, opts) {
})
.then(function() {
var name = reference.name();
return repo.setHead(name,
repo.defaultSignature(),
"Switch HEAD to " + name);
return repo.setHead(name);
});
};
......
......@@ -39,9 +39,11 @@ describe("Clone", function() {
var test = this;
var url = "https://github.com/nodegit/test.git";
var opts = {
remoteCallbacks: {
certificateCheck: function() {
return 1;
fetchOpts: {
callbacks: {
certificateCheck: function() {
return 1;
}
}
}
};
......@@ -56,9 +58,11 @@ describe("Clone", function() {
var test = this;
var url = "https://github.com/nodegit/test.git";
var opts = {
remoteCallbacks: {
certificateCheck: function() {
return 1;
fetchOpts: {
callbacks: {
certificateCheck: function() {
return 1;
}
}
}
};
......@@ -73,12 +77,14 @@ describe("Clone", function() {
var test = this;
var url = "git@github.com:nodegit/test.git";
var opts = {
remoteCallbacks: {
certificateCheck: function() {
return 1;
},
credentials: function(url, userName) {
return NodeGit.Cred.sshKeyFromAgent(userName);
fetchOpts: {
callbacks: {
certificateCheck: function() {
return 1;
},
credentials: function(url, userName) {
return NodeGit.Cred.sshKeyFromAgent(userName);
}
}
}
};
......@@ -93,16 +99,18 @@ describe("Clone", function() {
var test = this;
var url = "git@github.com:nodegit/test.git";
var opts = {
remoteCallbacks: {
certificateCheck: function() {
return 1;
},
credentials: function(url, userName) {
return NodeGit.Cred.sshKeyNew(
userName,
sshPublicKey,
sshPrivateKey,
"");
fetchOpts: {
callbacks: {
certificateCheck: function() {
return 1;
},
credentials: function(url, userName) {
return NodeGit.Cred.sshKeyNew(
userName,
sshPublicKey,
sshPrivateKey,
"");
}
}
}
};
......@@ -117,9 +125,11 @@ describe("Clone", function() {
var test = this;
var url = "git://github.com/nodegit/test.git";
var opts = {
remoteCallbacks: {
certificateCheck: function() {
return 1;
fetchOpts: {
callbacks: {
certificateCheck: function() {
return 1;
}
}
}
};
......@@ -145,13 +155,15 @@ describe("Clone", function() {
var url = "https://github.com/nodegit/private";
return Clone(url, clonePath, {
remoteCallbacks: {
certificateCheck: function() {
return 1;
},
credentials: function() {
return NodeGit.Cred.userpassPlaintextNew("fake-token",
"x-oauth-basic");
fetchOpts: {
callbacks: {
certificateCheck: function() {
return 1;
},
credentials: function() {
return NodeGit.Cred.userpassPlaintextNew("fake-token",
"x-oauth-basic");
}
}
}
}).catch(function unhandledError() { });
......
......@@ -13,7 +13,7 @@ describe("Config", function() {
var reposPath = local("../repos/workdir");
it("can get and set a global value", function() {
it.only("can get and set a global value", function() {
var savedUserName;
function finallyFn() {
......
......@@ -282,6 +282,9 @@
"ws2_32.lib"
],
},
"VCCLCompilerTool": {
"ObjectFile": "$(IntDir)/%(RelativeDir)/"
},
# Workaround of a strange bug:
# TargetMachine + static_library + x64 = nothing.
"conditions": [
......@@ -313,8 +316,8 @@
4013,
],
"sources": [
"libgit2/src/win32/wbuffer.c",
"libgit2/src/win32/wbuffer.h",
"libgit2/src/win32/buffer.c",
"libgit2/src/win32/buffer.h",
"libgit2/src/win32/dir.c",
"libgit2/src/win32/dir.h",
"libgit2/src/win32/error.c",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment