| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1132,7 +1132,7 @@ | |||
| 1132 | 1132 | "ignore": true | |
| 1133 | 1133 | }, | |
| 1134 | 1134 | "git_packbuilder_new": { | |
| 1135 | - "ignore": true | ||
| 1135 | + "isAsync": false | ||
| 1136 | 1136 | }, | |
| 1137 | 1137 | "git_packbuilder_set_callbacks": { | |
| 1138 | 1138 | "ignore": true | |
@@ -1182,6 +1182,9 @@ | |||
| 1182 | 1182 | "functions": { | |
| 1183 | 1183 | "git_pathspec_match_list_free": { | |
| 1184 | 1184 | "ignore": true | |
| 1185 | + }, | ||
| 1186 | + "git_pathspec_new": { | ||
| 1187 | + "isAsync": false | ||
| 1185 | 1188 | } | |
| 1186 | 1189 | } | |
| 1187 | 1190 | }, | |
@@ -1306,6 +1309,9 @@ | |||
| 1306 | 1309 | "remote": { | |
| 1307 | 1310 | "cType": "git_remote", | |
| 1308 | 1311 | "functions": { | |
| 1312 | + "git_remote_create": { | ||
| 1313 | + "isAsync": false | ||
| 1314 | + }, | ||
| 1309 | 1315 | "git_remote_connect": { | |
| 1310 | 1316 | "isAsync": true, | |
| 1311 | 1317 | "return": { | |
@@ -1596,7 +1602,7 @@ | |||
| 1596 | 1602 | "status_list": { | |
| 1597 | 1603 | "functions": { | |
| 1598 | 1604 | "git_status_list_new": { | |
| 1599 | - "isAsync": true, | ||
| 1605 | + "isAsync": false, | ||
| 1600 | 1606 | "args": { | |
| 1601 | 1607 | "opts": { | |
| 1602 | 1608 | "isOptional": true | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,11 +31,9 @@ Index.prototype.addAll = function(pathspec, flags, matchedCallback) { | |||
| 31 | 31 | paths.push(path); | |
| 32 | 32 | }; | |
| 33 | 33 | var idx = this; | |
| 34 | - return Pathspec.create(pathspec || "*") | ||
| 35 | - .then(function(ps) { | ||
| 36 | - pathspec = ps; | ||
| 37 | - return Status.foreach(repo, statusCB); | ||
| 38 | - }) | ||
| 34 | + var pathspec = Pathspec.create(pathspec || "*"); | ||
| 35 | + | ||
| 36 | + return Status.foreach(repo, statusCB) | ||
| 39 | 37 | .then(function() { | |
| 40 | 38 | return paths; | |
| 41 | 39 | }) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -798,14 +798,14 @@ Repository.prototype.getStatusExt = function(opts) { | |||
| 798 | 798 | }; | |
| 799 | 799 | } | |
| 800 | 800 | ||
| 801 | - return StatusList.create(this, opts).then(function(list) { | ||
| 802 | - for (var i = 0; i < list.entrycount(); i++) { | ||
| 803 | - var entry = Status.byIndex(list, i); | ||
| 804 | - statuses.push(new StatusFile({entry: entry})); | ||
| 805 | - } | ||
| 801 | + var list = StatusList.create(this, opts); | ||
| 806 | 802 | ||
| 807 | - return statuses; | ||
| 808 | - }); | ||
| 803 | + for (var i = 0; i < list.entrycount(); i++) { | ||
| 804 | + var entry = Status.byIndex(list, i); | ||
| 805 | + statuses.push(new StatusFile({entry: entry})); | ||
| 806 | + } | ||
| 807 | + | ||
| 808 | + return statuses; | ||
| 809 | 809 | }; | |
| 810 | 810 | ||
| 811 | 811 | /** | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,7 @@ var writeFile = promisify(function(filename, data, callback) { | |||
| 12 | 12 | describe("Index", function() { | |
| 13 | 13 | var NodeGit = require("../../"); | |
| 14 | 14 | var Repository = NodeGit.Repository; | |
| 15 | - | ||
| 15 | + | ||
| 16 | 16 | var reposPath = local("../repos/workdir"); | |
| 17 | 17 | ||
| 18 | 18 | beforeEach(function() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,25 @@ | |||
| 1 | + var assert = require("assert"); | ||
| 2 | + var path = require("path"); | ||
| 3 | + var local = path.join.bind(path, __dirname); | ||
| 4 | + | ||
| 5 | + describe("Packbuilder", function() { | ||
| 6 | + var NodeGit = require("../../"); | ||
| 7 | + var Repository = NodeGit.Repository; | ||
| 8 | + var Packbuilder = NodeGit.Packbuilder; | ||
| 9 | + | ||
| 10 | + var reposPath = local("../repos/workdir"); | ||
| 11 | + | ||
| 12 | + beforeEach(function() { | ||
| 13 | + var test = this; | ||
| 14 | + | ||
| 15 | + return Repository.open(reposPath).then(function(repository) { | ||
| 16 | + test.repository = repository; | ||
| 17 | + }); | ||
| 18 | + }); | ||
| 19 | + | ||
| 20 | + it("can be initialized", function() { | ||
| 21 | + var packBuilder = Packbuilder.create(this.repository); | ||
| 22 | + | ||
| 23 | + assert(packBuilder instanceof Packbuilder); | ||
| 24 | + }); | ||
| 25 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,46 +5,40 @@ describe("Pathspec", function() { | |||
| 5 | 5 | var Pathspec = NodeGit.Pathspec; | |
| 6 | 6 | ||
| 7 | 7 | it("can accept just about anything against a * pathspec", function() { | |
| 8 | - return Pathspec.create("*") | ||
| 9 | - .then(function(pathspec) { | ||
| 10 | - assert.equal(pathspec.matchesPath(0, "burritoooo"), 1); | ||
| 11 | - assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 1); | ||
| 12 | - }); | ||
| 8 | + var pathspec = Pathspec.create("*"); | ||
| 9 | + | ||
| 10 | + assert.equal(pathspec.matchesPath(0, "burritoooo"), 1); | ||
| 11 | + assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 1); | ||
| 13 | 12 | }); | |
| 14 | 13 | ||
| 15 | 14 | it("can take a * in an array", function() { | |
| 16 | - return Pathspec.create(["*"]) | ||
| 17 | - .then(function(pathspec) { | ||
| 18 | - assert.equal(pathspec.matchesPath(0, "burritoooo"), 1); | ||
| 19 | - assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 1); | ||
| 20 | - }); | ||
| 15 | + var pathspec = Pathspec.create("*"); | ||
| 16 | + | ||
| 17 | + assert.equal(pathspec.matchesPath(0, "burritoooo"), 1); | ||
| 18 | + assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 1); | ||
| 21 | 19 | }); | |
| 22 | 20 | ||
| 23 | 21 | it("can take a single file", function() { | |
| 24 | - return Pathspec.create(["myDir/burritoSupreme.mp4"]) | ||
| 25 | - .then(function(pathspec) { | ||
| 26 | - assert.equal(pathspec.matchesPath(0, "myDir/burritoSupreme.mp4"), 1); | ||
| 27 | - assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 0); | ||
| 28 | - }); | ||
| 22 | + var pathspec = Pathspec.create(["myDir/burritoSupreme.mp4"]); | ||
| 23 | + | ||
| 24 | + assert.equal(pathspec.matchesPath(0, "myDir/burritoSupreme.mp4"), 1); | ||
| 25 | + assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 0); | ||
| 29 | 26 | }); | |
| 30 | 27 | ||
| 31 | 28 | it("can take files in an array", function() { | |
| 32 | - return Pathspec.create(["gwendoline.txt", "sausolito.ogg"]) | ||
| 33 | - .then(function(pathspec) { | ||
| 34 | - assert.equal(pathspec.matchesPath(0, "gwendoline.txt"), 1); | ||
| 35 | - assert.equal(pathspec.matchesPath(0, "sausolito.ogg"), 1); | ||
| 36 | - assert.equal(pathspec.matchesPath(0, "sausolito.txt"), 0); | ||
| 37 | - }); | ||
| 29 | + var pathspec = Pathspec.create(["gwendoline.txt", "sausolito.ogg"]) | ||
| 30 | + | ||
| 31 | + assert.equal(pathspec.matchesPath(0, "gwendoline.txt"), 1); | ||
| 32 | + assert.equal(pathspec.matchesPath(0, "sausolito.ogg"), 1); | ||
| 33 | + assert.equal(pathspec.matchesPath(0, "sausolito.txt"), 0); | ||
| 38 | 34 | }); | |
| 39 | 35 | ||
| 40 | 36 | it("can handle dirs", function() { | |
| 41 | - return Pathspec.create(["myDir/", "bob.js"]) | ||
| 42 | - .then(function(pathspec) { | ||
| 43 | - assert.equal(pathspec.matchesPath(0, "bob.js"), 1); | ||
| 44 | - assert.equal(pathspec.matchesPath(0, "myDir/bob2.js"), 1); | ||
| 45 | - assert.equal(pathspec.matchesPath(0, "bob2.js"), 0); | ||
| 46 | - assert.equal(pathspec.matchesPath(0, "herDir/bob.js"), 0); | ||
| 47 | - }); | ||
| 48 | - }); | ||
| 37 | + var pathspec = Pathspec.create(["myDir/", "bob.js"]) | ||
| 49 | 38 | ||
| 39 | + assert.equal(pathspec.matchesPath(0, "bob.js"), 1); | ||
| 40 | + assert.equal(pathspec.matchesPath(0, "myDir/bob2.js"), 1); | ||
| 41 | + assert.equal(pathspec.matchesPath(0, "bob2.js"), 0); | ||
| 42 | + assert.equal(pathspec.matchesPath(0, "herDir/bob.js"), 0); | ||
| 43 | + }); | ||
| 50 | 44 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,16 +53,10 @@ describe("Remote", function() { | |||
| 53 | 53 | ||
| 54 | 54 | it("can set a remote", function() { | |
| 55 | 55 | var repository = this.repository; | |
| 56 | - var newRemote; | ||
| 56 | + var remote = Remote.create(repository, "origin1", url); | ||
| 57 | 57 | ||
| 58 | - return Remote.create(repository, "origin1", url) | ||
| 59 | - .then(function(remote) { | ||
| 60 | - newRemote = remote; | ||
| 61 | - return remote.setPushurl("https://google.com/"); | ||
| 62 | - }) | ||
| 63 | - .then(function() { | ||
| 64 | - assert(newRemote.pushurl(), "https://google.com/"); | ||
| 65 | - }); | ||
| 58 | + remote.setPushurl("https://google.com/"); | ||
| 59 | + assert(remote.pushurl(), "https://google.com/"); | ||
| 66 | 60 | }); | |
| 67 | 61 | ||
| 68 | 62 | it("can read the remote name", function() { | |
@@ -71,24 +65,20 @@ describe("Remote", function() { | |||
| 71 | 65 | ||
| 72 | 66 | it("can create and load a new remote", function() { | |
| 73 | 67 | var repository = this.repository; | |
| 68 | + var remote = Remote.create(repository, "origin2", url); | ||
| 74 | 69 | ||
| 75 | - return Remote.create(repository, "origin2", url) | ||
| 76 | - .then(function() { | ||
| 77 | - return Remote.lookup(repository, "origin2"); | ||
| 78 | - }) | ||
| 79 | - .then(function(remote) { | ||
| 80 | - assert(remote.url(), url); | ||
| 81 | - }); | ||
| 70 | + return Remote.lookup(repository, "origin2").then(function() { | ||
| 71 | + assert(remote.url(), url); | ||
| 72 | + }); | ||
| 82 | 73 | }); | |
| 83 | 74 | ||
| 84 | 75 | it("can delete a remote", function() { | |
| 85 | 76 | var repository = this.repository; | |
| 77 | + var remote = Remote.create(repository, "origin3", url); | ||
| 86 | 78 | ||
| 87 | - return Remote.create(repository, "origin3", url) | ||
| 88 | - .then(function(remote) { | ||
| 89 | - Remote.delete(repository, "origin3"); | ||
| 90 | - return Remote.lookup(repository, "origin3"); | ||
| 91 | - }) | ||
| 79 | + Remote.delete(repository, "origin3"); | ||
| 80 | + | ||
| 81 | + return Remote.lookup(repository, "origin3") | ||
| 92 | 82 | .then(Promise.reject, Promise.resolve); | |
| 93 | 83 | }); | |
| 94 | 84 | ||
@@ -119,31 +109,30 @@ describe("Remote", function() { | |||
| 119 | 109 | var repo = this.repository; | |
| 120 | 110 | var wasCalled = false; | |
| 121 | 111 | ||
| 122 | - return Remote.create(repo, "test2", url2) | ||
| 123 | - .then(function() { | ||
| 124 | - return repo.getRemote("test2"); | ||
| 125 | - }) | ||
| 126 | - .then(function(remote) { | ||
| 127 | - remote.setCallbacks({ | ||
| 128 | - credentials: function(url, userName) { | ||
| 129 | - return NodeGit.Cred.sshKeyFromAgent(userName); | ||
| 130 | - }, | ||
| 131 | - certificateCheck: function() { | ||
| 132 | - return 1; | ||
| 133 | - }, | ||
| 134 | - | ||
| 135 | - transferProgress: function() { | ||
| 136 | - wasCalled = true; | ||
| 137 | - } | ||
| 138 | - }); | ||
| 112 | + var remote = Remote.create(repo, "test2", url2); | ||
| 139 | 113 | ||
| 140 | - return remote.fetch(null, repo.defaultSignature(), null); | ||
| 141 | - }) | ||
| 142 | - .then(function() { | ||
| 143 | - assert.ok(wasCalled); | ||
| 114 | + return repo.getRemote("test2") | ||
| 115 | + .then(function(remote) { | ||
| 116 | + remote.setCallbacks({ | ||
| 117 | + credentials: function(url, userName) { | ||
| 118 | + return NodeGit.Cred.sshKeyFromAgent(userName); | ||
| 119 | + }, | ||
| 120 | + certificateCheck: function() { | ||
| 121 | + return 1; | ||
| 122 | + }, | ||
| 144 | 123 | ||
| 145 | - Remote.delete(repo, "test2"); | ||
| 146 | - }); | ||
| 124 | + transferProgress: function() { | ||
| 125 | + wasCalled = true; | ||
| 126 | + } | ||
| 127 | + }); | ||
| 128 | + | ||
| 129 | + return remote.fetch(null, repo.defaultSignature(), null); | ||
| 130 | + }) | ||
| 131 | + .then(function() { | ||
| 132 | + assert.ok(wasCalled); | ||
| 133 | + | ||
| 134 | + Remote.delete(repo, "test2"); | ||
| 135 | + }); | ||
| 147 | 136 | }); | |
| 148 | 137 | ||
| 149 | 138 | it("can fetch from a remote", function() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -120,12 +120,12 @@ describe("Repository", function() { | |||
| 120 | 120 | ||
| 121 | 121 | return fse.writeFile(filePath, fileContent) | |
| 122 | 122 | .then(function() { | |
| 123 | - return repo.getStatusExt().then(function(statuses) { | ||
| 124 | - assert.equal(statuses.length, 1); | ||
| 125 | - assert.equal(statuses[0].path(), fileName); | ||
| 126 | - assert.equal(statuses[0].indexToWorkdir().newFile().path(), fileName); | ||
| 127 | - assert.ok(statuses[0].isNew()); | ||
| 128 | - }); | ||
| 123 | + var statuses = repo.getStatusExt(); | ||
| 124 | + | ||
| 125 | + assert.equal(statuses.length, 1); | ||
| 126 | + assert.equal(statuses[0].path(), fileName); | ||
| 127 | + assert.equal(statuses[0].indexToWorkdir().newFile().path(), fileName); | ||
| 128 | + assert.ok(statuses[0].isNew()); | ||
| 129 | 129 | }) | |
| 130 | 130 | .then(function() { | |
| 131 | 131 | return fse.remove(filePath); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments