WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions test/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ describe("Index", function() {
this.index.clear();
});

// THIS TEST DOES NOT MAKE IT FAIL
it.skip("can remove repo's folder after accessing its index", function() {
var entries = this.index.entries();

assert.equal(entries[0].path, ".gitignore");
return fse.remove(reposPath)
.then(function() {
assert.equal(false, fse.existsSync(reposPath));
});
});

it("can get the index of a repo and examine entries", function() {
var entries = this.index.entries();

Expand Down
125 changes: 125 additions & 0 deletions test/tests/submodule.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var assert = require("assert");
var path = require("path");
var fse = require("fs-extra");
var local = path.join.bind(path, __dirname);

describe("Submodule", function() {
Expand Down Expand Up @@ -158,6 +159,130 @@ describe("Submodule", function() {
});
});

// THIS TEST MAKES IT FAIL
it.skip("make remove repo fail 01", function() {
this.timeout(30000);

var repo = this.repository;
var submodulePath = "nodegittest";
var submoduleUrl = "https://github.com/nodegit/test.git";

var submodule;
var submoduleRepo;

return NodeGit.Submodule.addSetup(repo, submoduleUrl, submodulePath, 0)
.then(function(_submodule) {
submodule = _submodule;

return submodule.init(0);
})
.then(function() {
return submodule.open();
})
.then(function(_submoduleRepo) {
submoduleRepo = _submoduleRepo;
return submoduleRepo.fetch("origin", null, null);
})
.then(function() {
return submoduleRepo.getReference("origin/master");
})
.then(function(reference) {
return reference.peel(NodeGit.Object.TYPE.COMMIT);
})
.then(function(commit) {
return submoduleRepo.createBranch("master", commit.id());
})
.then(function() {
return submodule.addFinalize();
})
.then(function() {
// check whether the submodule exists
return Submodule.lookup(repo, submodulePath);
})
.then(function(submodule) {
assert.equal(submodule.name(), submodulePath);
// check whether .gitmodules and the submodule are in the index
return repo.refreshIndex();
})
.then(function(index) {
var entries = index.entries();
assert.equal(entries.length, 2);
assert.equal(entries[0].path, ".gitmodules");
assert.equal(entries[1].path, submodulePath);
return fse.remove(repoPath);
})
.then(function() {
assert.equal(false, fse.existsSync(repoPath));
});
});

// THIS TEST MAKES IT FAIL
it.skip("make remove repo fail 02", function() {
this.timeout(30000);

var repo = this.repository;
var submodulePath = "nodegittest";
var submoduleUrl = "https://github.com/nodegit/test.git";

var submodule;
var submoduleRepo;

return NodeGit.Submodule.addSetup(repo, submoduleUrl, submodulePath, 0)
.then(function(_submodule) {
submodule = _submodule;

return submodule.init(0);
})
.then(function() {
return submodule.open();
})
.then(function(_submoduleRepo) {
submoduleRepo = _submoduleRepo;
return submoduleRepo.fetch("origin", null, null);
})
.then(function() {
return repo.refreshIndex();
})
.then(function(index) {
return fse.remove(repoPath);
})
.then(function() {
assert.equal(false, fse.existsSync(repoPath));
});
});

// THIS TEST MAKES IT FAIL
it.only("make remove repo fail 03", function() {
this.timeout(30000);

var repo = this.repository;
var submodulePath = "nodegittest";
var submoduleUrl = "https://github.com/nodegit/test.git";

var submodule;
var submoduleRepo;

return NodeGit.Submodule.addSetup(repo, submoduleUrl, submodulePath, 0)
.then(function(_submodule) {
submodule = _submodule;

return submodule.init(0);
})
.then(function() {
return submodule.open();
})
.then(function(_submoduleRepo) {
submoduleRepo = _submoduleRepo;
return submoduleRepo.fetch("origin", null, null);
})
.then(function() {
return fse.remove(repoPath);
})
.then(function() {
assert.equal(false, fse.existsSync(repoPath));
});
});

it("can run sync callback without deadlocking", function() {
var repo = this.workdirRepository;
var submodules = [];
Expand Down