File tree Expand file tree Collapse file tree 2 files changed +12
-16
lines changed
Expand file tree Collapse file tree 2 files changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ describe("Index", function() {
311311
312312 it ( "can add a conflict to the index" , function ( ) {
313313 var repo ;
314- var repoPath = path . join ( __dirname , ".." , " repos" , " index") ;
314+ var repoPath = local ( "../ repos/ index" ) ;
315315 var ourBranchName = "ours" ;
316316 var theirBranchName = "theirs" ;
317317 var fileName = "testFile.txt" ;
@@ -329,6 +329,10 @@ describe("Index", function() {
329329 fileName
330330 ) ;
331331 } )
332+ . then ( function ( index ) {
333+ assert . ok ( index . hasConflicts ( ) ) ;
334+ return index . conflictGet ( fileName ) ;
335+ } )
332336 . then ( function ( indexEntries ) {
333337 // Store all indexEntries for conflict
334338 ancestorIndexEntry = indexEntries . ancestor_out ;
Original file line number Diff line number Diff line change 1- var assert = require ( "assert" ) ;
21var NodeGit = require ( "../../" ) ;
32var path = require ( "path" ) ;
43var promisify = require ( "promisify-node" ) ;
@@ -75,25 +74,18 @@ var IndexSetup = {
7574 return repository . createCommit ( ourBranch . name ( ) , ourSignature ,
7675 ourSignature , "we made a commit" , oid , [ ourCommit ] ) ;
7776 } )
78- . then ( function ( commitOid ) {
79- var opts = {
80- checkoutStrategy : NodeGit . Checkout . STRATEGY . FORCE
81- } ;
82-
83- return NodeGit . Checkout . head ( repository , opts ) ;
77+ . then ( function ( ) {
78+ return repository . checkoutBranch (
79+ ourBranch ,
80+ new NodeGit . CheckoutOptions ( )
81+ ) ;
8482 } )
8583 . then ( function ( ) {
8684 return repository . mergeBranches ( ourBranchName , theirBranchName ) ;
8785 } )
88- . then ( function ( commit ) {
89- assert . fail ( commit , undefined ,
90- "The index should have been thrown due to merge conflicts" ) ;
91- } )
9286 . catch ( function ( index ) {
93- assert . ok ( index ) ;
94- assert . ok ( index . hasConflicts ( ) ) ;
95-
96- return index . conflictGet ( fileName ) ;
87+ return NodeGit . Checkout . index ( repository , index )
88+ . then ( function ( ) { return index ; } ) ;
9789 } ) ;
9890 }
9991} ;
You can’t perform that action at this time.
0 commit comments