Skip to content

Commit 9d13f09

Browse files
author
John Haley
committed
Increased support for Push, Remote and Direction enums
1 parent 5e4cd12 commit 9d13f09

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

generate/descriptor.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -946,9 +946,6 @@
946946
"push": {
947947
"cType": "git_push",
948948
"functions": {
949-
"git_push_new": {
950-
"ignore": true
951-
},
952949
"git_push_set_callbacks": {
953950
"ignore": true
954951
},

generate/libgit2-supplement.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,22 @@
115115
[
116116
"git_direction",
117117
{
118-
"type": "enum"
118+
"type": "enum",
119+
"description": "Enum to indicate the direction that a remote connection is going to go",
120+
"fields": [
121+
{
122+
"type": "int",
123+
"name": "GIT_DIRECTION_FETCH",
124+
"comments": "Fetching from the remote repository",
125+
"value": 0
126+
},
127+
{
128+
"type": "int",
129+
"name": "GIT_DIRECTION_PUSH",
130+
"comments": "Pushing to a remote repository",
131+
"value": 1
132+
}
133+
]
119134
}
120135
],
121136
[

lib/remote.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
var NodeGit = require("../");
2+
var normalizeOptions = require("./util/normalize_options");
23

34
var Remote = NodeGit.Remote;
5+
var setCallbacks = Remote.prototype.setCallbacks;
6+
7+
Remote.prototype.setCallbacks = function(callbacks) {
8+
callbacks = normalizeOptions(callbacks, NodeGit.RemoteCallbacks);
9+
10+
return setCallbacks.call(this, callbacks);
11+
};
412

513
module.exports = Remote;

test/tests/remote.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var path = require("path");
44
describe("Remote", function() {
55
var reposPath = path.resolve("test/repos/workdir/.git");
66

7+
var NodeGit = require("../../");
78
var Repository = require("../../lib/repository");
89
var Remote = require("../../lib/remote");
910

@@ -91,8 +92,8 @@ describe("Remote", function() {
9192
var repo = this.repository;
9293

9394
return Remote.load(repo, "origin")
94-
.then(function(remote) {
95-
remote.connect(0);
95+
.then(function(remote)
96+
remote.connect(NodeGit.Enums.DIRECTION.FETCH);
9697
return remote.download();
9798
})
9899
.then(function() {

0 commit comments

Comments
 (0)