Skip to content

Commit 1180354

Browse files
committed
Merge pull request nodegit#367 from nodegit/fix-checkout-head
`Checkout.head` initializes options if none are passed
2 parents 0322cae + a06da32 commit 1180354

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

lib/checkout.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
var NodeGit = require("../");
2+
var normalizeOptions = require("./util/normalize_options");
23

34
var Checkout = NodeGit.Checkout;
5+
var head = Checkout.head;
6+
7+
/**
8+
* Patch head checkout to automatically coerce objects.
9+
*
10+
* @param repo
11+
* @param options
12+
*/
13+
Checkout.head = function(url, options) {
14+
options = normalizeOptions(options, NodeGit.CheckoutOptions);
15+
16+
return head.call(this, url, options);
17+
};
18+
419

520
module.exports = Checkout;

test/tests/checkout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("Checkout", function() {
1919
it("can checkout the head", function() {
2020
var repo = this.repo;
2121

22-
Checkout.head(repo)
22+
return Checkout.head(repo)
2323
.then(function() {
2424
return repo.getBlob(packageJsonOid);
2525
})

0 commit comments

Comments
 (0)