Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
6 changes: 5 additions & 1 deletion 6 test/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ describe("Index", function() {

it("can add a conflict to the index", function() {
var repo;
var repoPath = path.join(__dirname, "..", "repos", "index");
var repoPath = local("../repos/index");
var ourBranchName = "ours";
var theirBranchName = "theirs";
var fileName = "testFile.txt";
Expand All @@ -329,6 +329,10 @@ describe("Index", function() {
fileName
);
})
.then(function(index) {
assert.ok(index.hasConflicts());
return index.conflictGet(fileName);
})
.then(function(indexEntries) {
// Store all indexEntries for conflict
ancestorIndexEntry = indexEntries.ancestor_out;
Expand Down
22 changes: 7 additions & 15 deletions 22 test/utils/index_setup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var assert = require("assert");
var NodeGit = require("../../");
var path = require("path");
var promisify = require("promisify-node");
Expand Down Expand Up @@ -75,25 +74,18 @@ var IndexSetup = {
return repository.createCommit(ourBranch.name(), ourSignature,
ourSignature, "we made a commit", oid, [ourCommit]);
})
.then(function(commitOid) {
var opts = {
checkoutStrategy: NodeGit.Checkout.STRATEGY.FORCE
};

return NodeGit.Checkout.head(repository, opts);
.then(function() {
return repository.checkoutBranch(
ourBranch,
new NodeGit.CheckoutOptions()
);
})
.then(function() {
return repository.mergeBranches(ourBranchName, theirBranchName);
})
.then(function(commit) {
assert.fail(commit, undefined,
"The index should have been thrown due to merge conflicts");
})
.catch(function(index) {
assert.ok(index);
assert.ok(index.hasConflicts());

return index.conflictGet(fileName);
return NodeGit.Checkout.index(repository, index)
.then(function() { return index; });
});
}
};
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.