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

Added additional remote methods by tbranyen · Pull Request #206 · 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  (1) .json  (2) dotfile  (1) All 3 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
4 changes: 3 additions & 1 deletion .jshintrc
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 @@ -18,6 +18,8 @@
"it": true,
"describe": true,
"before": true,
"beforeEach": true
"beforeEach": true,
"after": true,
"afterEach": true
}
}
29 changes: 28 additions & 1 deletion generate/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 @@ -555,11 +555,38 @@
}
},

"git_remote_load": {
"git_remote_create": {
"ignore": false,
"isConstructorMethod": true
},

"git_remote_rename": {
"ignore": false
},

"git_remote_name": {
"ignore": false,
"args": [{ "isSelf": true }]
},

"git_remote_pushurl": {
"ignore": false,
"args": [{ "isSelf": true }]
},

"git_remote_load": {
"ignore": false,
"isConstructorMethod": true,
"return": {
"copy": "git_remote_dup"
}
},

"git_remote_delete": {
"ignore": false,
"args": [{ "isReturn": false, "isSelf": true }]
},

"git_remote_url": {
"ignore": false,
"args": [{ "isSelf": true }]
Expand Down
12 changes: 12 additions & 0 deletions generate/types.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 @@ -9055,5 +9055,17 @@
"const git_strarray **": {
"cpp": "GitStrarray",
"js": "Strarray"
},
"git_remote_delete": {
"cpp": "Delete",
"js": "delete"
},
"git_remote_delete *": {
"cpp": "Delete",
"js": "delete"
},
"const git_remote_delete *": {
"cpp": "Delete",
"js": "delete"
}
}
47 changes: 42 additions & 5 deletions test/tests/remote.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
@@ -1,7 +1,7 @@
var assert = require("assert");
var path = require("path");

describe("Repository", function() {
describe("Remote", function() {
var reposPath = path.resolve("test/repos/workdir/.git");

var Repository = require("../../lib/repository");
Expand All @@ -12,13 +12,50 @@ describe("Repository", function() {

return Repository.open(reposPath).then(function(repository) {
test.repository = repository;

return Remote.load(repository, "origin").then(function(remote) {
test.remote = remote;
});
});
});

after(function() {
return Remote.load(this.repository, "origin2").then(function(remote) {
remote.delete();
});
});

it("can read git remote url", function() {
return Remote.load(this.repository, "origin").then(function(remote) {
assert.ok(remote instanceof Remote);
assert.equal(remote.url(), "https://github.com/nodegit/nodegit");
it("can load a remote", function() {
assert.ok(this.remote instanceof Remote);
});

it("can read the remote url", function() {
assert.equal(this.remote.url(), "https://github.com/nodegit/nodegit");
});

it("can read the remote name", function() {
assert.equal(this.remote.name(), "origin");
});

it("can create a new remote", function() {
var repository = this.repository;
var url = "https://github.com/nodegit/nodegit";

return Remote.create(repository, "origin2", url).then(function() {
return Remote.load(repository, "origin2").then(function(remote) {
assert(remote.url(), "https://github.com/nodegit/nodegit");
});
});
});

it("can delete a remote", function() {
var repository = this.repository;
var url = "https://github.com/nodegit/nodegit";

return Remote.create(repository, "origin3", url).then(function() {
return Remote.load(repository, "origin3").then(function(remote) {
remote.delete();
});
});
});
});

Back | FazBrowse Home | New Git URL