forked from nodegit/nodegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckout.js
More file actions
51 lines (44 loc) · 1.39 KB
/
checkout.js
File metadata and controls
51 lines (44 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var NodeGit = require("../");
var normalizeOptions = NodeGit.Utils.normalizeOptions;
var Checkout = NodeGit.Checkout;
var _head = Checkout.head;
var _index = Checkout.index;
var _tree = Checkout.tree;
/**
* Patch head checkout to automatically coerce objects.
*
* @async
* @param {Repository} repo The repo to checkout head
* @param {CheckoutOptions} [options] Options for the checkout
* @return {Void} checkout complete
*/
Checkout.head = function(url, options) {
options = normalizeOptions(options || {}, NodeGit.CheckoutOptions);
return _head.call(this, url, options);
};
/**
* Patch index checkout to automatically coerce objects.
*
* @async
* @param {Repository} repo The repo to checkout an index
* @param {Index} index The index to checkout
* @param {CheckoutOptions} [options] Options for the checkout
* @return {Void} checkout complete
*/
Checkout.index = function(repo, index, options) {
options = normalizeOptions(options || {}, NodeGit.CheckoutOptions);
return _index.call(this, repo, index, options);
};
/**
* Patch tree checkout to automatically coerce objects.
*
* @async
* @param {Repository} repo
* @param {String|Tree|Commit|Reference} treeish
* @param {CheckoutOptions} [options]
* @return {Void} checkout complete
*/
Checkout.tree = function(repo, treeish, options) {
options = normalizeOptions(options || {}, NodeGit.CheckoutOptions);
return _tree.call(this, repo, treeish, options);
};