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

Better cloning with NodeGit by tbranyen · Pull Request #453 · 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  (4) All 1 file type 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
2 changes: 1 addition & 1 deletion examples/clone.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 @@ -6,7 +6,7 @@ var path = "/tmp/nodegit-clone-demo";
fse.remove(path).then(function() {
var entry;

nodegit.Clone.clone(
nodegit.Clone(
"https://github.com/nodegit/nodegit.git",
path,
{
Expand Down
2 changes: 1 addition & 1 deletion examples/cloneFromGithubWith2Factor.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 @@ -36,7 +36,7 @@ var opts = {
};

fse.remove(path).then(function() {
nodegit.Clone.clone(repoUrl, path, opts)
nodegit.Clone(repoUrl, path, opts)
.done(function(repo) {
if (repo instanceof nodegit.Repository) {
console.info("We cloned the repo!");
Expand Down
8 changes: 7 additions & 1 deletion lib/clone.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 @@ -45,4 +45,10 @@ Clone.clone = function(url, local_path, options) {
.then(openRepository);
};

module.exports = Clone;
// Inherit directly from the original clone object.
Clone.clone.__proto__ = Clone;

// Ensure we're using the correct prototype.
Clone.clone.prototype = Clone.prototype;

module.exports = Clone.clone;
16 changes: 8 additions & 8 deletions test/tests/clone.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 @@ -6,7 +6,7 @@ var local = path.join.bind(path, __dirname);

describe("Clone", function() {
var Repository = require(local("../../lib/repository"));
var Clone = require(local("../../lib/clone"));
var clone = require(local("../../lib/clone"));
var NodeGit = require(local("../../"));

var clonePath = local("../repos/clone");
Expand All @@ -29,7 +29,7 @@ describe("Clone", function() {
var test = this;
var url = "http://git.tbranyen.com/smart/site-content";

return Clone.clone(url, clonePath).then(function(repo) {
return clone(url, clonePath).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
Expand All @@ -46,7 +46,7 @@ describe("Clone", function() {
}
};

return Clone.clone(url, clonePath, opts).then(function(repo) {
return clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
Expand All @@ -66,7 +66,7 @@ describe("Clone", function() {
}
};

return Clone.clone(url, clonePath, opts).then(function(repo) {
return clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
Expand All @@ -90,7 +90,7 @@ describe("Clone", function() {
}
};

return Clone.clone(url, clonePath, opts).then(function(repo) {
return clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
Expand All @@ -107,7 +107,7 @@ describe("Clone", function() {
}
};

return Clone.clone(url, clonePath, opts).then(function(repo) {
return clone(url, clonePath, opts).then(function(repo) {
test.repository = repo;
assert.ok(repo instanceof Repository);
});
Expand All @@ -118,7 +118,7 @@ describe("Clone", function() {
var prefix = process.platform === "win32" ? "" : "file://";
var url = prefix + local("../repos/empty");

return Clone.clone(url, clonePath).then(function(repo) {
return clone(url, clonePath).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
Expand All @@ -127,7 +127,7 @@ describe("Clone", function() {
it("will not segfault when accessing a url without username", function() {
var url = "https://github.com/nodegit/private";

return Clone.clone(url, clonePath, {
return clone(url, clonePath, {
remoteCallbacks: {
certificateCheck: function() {
return 1;
Expand Down

Back | FazBrowse Home | New Git URL