| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a3f6bd4 commit 078163c
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -329,6 +329,13 @@ describe("Index", function() { | |||
| 329 | 329 | fileName | |
| 330 | 330 | ); | |
| 331 | 331 | }) | |
| 332 | + .then(function() { | ||
| 333 | + return repo.openIndex(); | ||
| 334 | + }) | ||
| 335 | + .then(function(conflictedIndex) { | ||
| 336 | + assert.ok(conflictedIndex.hasConflicts()); | ||
| 337 | + return conflictedIndex.conflictGet(fileName); | ||
| 338 | + }) | ||
| 332 | 339 | .then(function(indexEntries) { | |
| 333 | 340 | // Store all indexEntries for conflict | |
| 334 | 341 | ancestorIndexEntry = indexEntries.ancestor_out; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - var assert = require("assert"); | ||
| 2 | 1 | var NodeGit = require("../../"); | |
| 3 | 2 | var path = require("path"); | |
| 4 | 3 | var promisify = require("promisify-node"); | |
@@ -80,20 +79,25 @@ var IndexSetup = { | |||
| 80 | 79 | checkoutStrategy: NodeGit.Checkout.STRATEGY.FORCE | |
| 81 | 80 | }; | |
| 82 | 81 | ||
| 83 | - return NodeGit.Checkout.head(repository, opts); | ||
| 82 | + return repository.checkoutBranch(ourBranchName, opts); | ||
| 84 | 83 | }) | |
| 85 | 84 | .then(function() { | |
| 86 | - return repository.mergeBranches(ourBranchName, theirBranchName); | ||
| 85 | + return NodeGit.AnnotatedCommit.fromRef(repository, theirBranch); | ||
| 87 | 86 | }) | |
| 88 | - .then(function(commit) { | ||
| 89 | - assert.fail(commit, undefined, | ||
| 90 | - "The index should have been thrown due to merge conflicts"); | ||
| 87 | + .then(function(theirAnnotatedCommit) { | ||
| 88 | + var checkoutOpts = { | ||
| 89 | + checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE | ||
| 90 | + | NodeGit.Checkout.STRATEGY.RECREATE_MISSING | ||
| 91 | + }; | ||
| 92 | + return NodeGit.Merge.merge( | ||
| 93 | + repository, | ||
| 94 | + theirAnnotatedCommit, | ||
| 95 | + null, | ||
| 96 | + checkoutOpts | ||
| 97 | + ); | ||
| 91 | 98 | }) | |
| 92 | - .catch(function(index) { | ||
| 93 | - assert.ok(index); | ||
| 94 | - assert.ok(index.hasConflicts()); | ||
| 95 | - | ||
| 96 | - return index.conflictGet(fileName); | ||
| 99 | + .then(function() { | ||
| 100 | + return repository.openIndex(); | ||
| 97 | 101 | }); | |
| 98 | 102 | } | |
| 99 | 103 | }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments