Skip to content

Commit dfbfba0

Browse files
committed
Fixed merge tests
Replaced checkout.strategy.safe_create with checkout.strategy_safe | strategy.recreate_missing, fixed merge tests
1 parent 09b1aa5 commit dfbfba0

File tree

8 files changed

+22
-12
lines changed

8 files changed

+22
-12
lines changed

examples/merge-with-conflicts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ fse.remove(path.resolve(__dirname, repoDir))
146146
return nodegit.Reference.lookup(repository, "HEAD");
147147
})
148148
.then(function(head) {
149-
return head.symbolicSetTarget(ourBranch.name(), ourSignature, "");
149+
return head.symbolicSetTarget(ourBranch.name(), "");
150150
})
151151

152152

generate/input/descriptor.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,9 @@
604604
"file_cb" : {
605605
"isOptional": true
606606
},
607+
"binary_cb": {
608+
"isOptional": true
609+
},
607610
"hunk_cb" : {
608611
"isOptional": true
609612
},
@@ -1491,9 +1494,6 @@
14911494
},
14921495
"git_reference_symbolic_set_target": {
14931496
"args": {
1494-
"signature": {
1495-
"isOptional": true
1496-
},
14971497
"log_message": {
14981498
"isOptional": true
14991499
}

lib/diff.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Diff.blobToBuffer= function(
8383
buffer_as_path,
8484
opts,
8585
file_cb,
86+
binary_cb,
8687
hunk_cb,
8788
line_cb) {
8889
var bufferLength = !buffer ? 0 : buffer.length;
@@ -98,6 +99,7 @@ Diff.blobToBuffer= function(
9899
buffer_as_path,
99100
opts,
100101
file_cb,
102+
binary_cb,
101103
hunk_cb,
102104
line_cb,
103105
null);

lib/rebase.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ var next = Rebase.prototype.next;
1414
Rebase.prototype.next = function(checkoutOpts) {
1515
if (!checkoutOpts) {
1616
checkoutOpts = {
17-
checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE_CREATE
17+
checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE |
18+
NodeGit.Checkout.STRATEGY.RECREATE_MISSING
1819
};
1920
}
2021

lib/repository.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -752,15 +752,15 @@ Repository.prototype.mergeBranches =
752752
if (toBranch.isHead()) {
753753
// Checkout the tree if we're on the branch
754754
var opts = {
755-
checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE_CREATE
755+
checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE |
756+
NodeGit.Checkout.STRATEGY.RECREATE_MISSING
756757
};
757758
return NodeGit.Checkout.tree(repo, tree, opts);
758759
}
759760
})
760761
.then(function() {
761762
return toBranch.setTarget(
762763
fromCommitOid,
763-
signature,
764764
message)
765765
.then(function() {
766766
return fromCommitOid;
@@ -816,7 +816,8 @@ Repository.prototype.mergeBranches =
816816
})
817817
.then(function(tree) {
818818
var opts = {
819-
checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE_CREATE
819+
checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE |
820+
NodeGit.Checkout.STRATEGY.RECREATE_MISSING
820821
};
821822
return NodeGit.Checkout.tree(repo, tree, opts);
822823
})
@@ -1048,7 +1049,8 @@ Repository.prototype.checkoutBranch = function(branch, opts) {
10481049
opts = opts || {};
10491050

10501051
opts.checkoutStrategy = opts.checkoutStrategy ||
1051-
Checkout.STRATEGY.SAFE;
1052+
(NodeGit.Checkout.STRATEGY.SAFE |
1053+
NodeGit.Checkout.STRATEGY.RECREATE_MISSING);
10521054
return repo.getReference(branch)
10531055
.then(function(ref) {
10541056
if (!ref.isBranch()) {

test/tests/diff.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ describe("Diff", function() {
206206
null,
207207
null,
208208
null,
209+
null,
209210
function(delta, hunk, payload) {
210211
assert.equal(hunk.oldStart(), 1);
211212
assert.equal(hunk.oldLines(), 19);

test/tests/merge.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,10 @@ describe("Merge", function() {
328328
});
329329
})
330330
.then(function() {
331-
var opts = {checkoutStrategy: NodeGit.Checkout.STRATEGY.FORCE};
331+
var opts = {
332+
checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE |
333+
NodeGit.Checkout.STRATEGY.RECREATE_MISSING
334+
};
332335
return repository.checkoutBranch(ourBranchName, opts);
333336
})
334337
.then(function() {
@@ -1002,7 +1005,7 @@ describe("Merge", function() {
10021005
.then(function() {
10031006
return NodeGit.Reference.lookup(repository, "HEAD")
10041007
.then(function(head) {
1005-
return head.symbolicSetTarget(ourBranch.name(), ourSignature, "");
1008+
return head.symbolicSetTarget(ourBranch.name(), "");
10061009
});
10071010
})
10081011
.then(function() {

test/tests/rebase.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ describe("Rebase", function() {
293293
assert.equal(rebase.operationEntrycount(), 1);
294294

295295
var opts = new NodeGit.CheckoutOptions();
296-
opts.checkoutStrategy = NodeGit.Checkout.STRATEGY.SAFE_CREATE;
296+
opts.checkoutStrategy = NodeGit.Checkout.STRATEGY.SAFE |
297+
NodeGit.Checkout.STRATEGY.RECREATE_MISSING;
297298

298299
return rebase.next(opts);
299300
})

0 commit comments

Comments
 (0)