-
Notifications
You must be signed in to change notification settings - Fork 56
/
gitteh.js
77 lines (65 loc) · 1.59 KB
/
gitteh.js
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var bindings = require("bindings")("gitteh.node")
, utils = require("./utils")
, args = require("./args");
var helpers = ['signature', 'refspec', 'commit', 'tree', 'blob', 'tag', 'remote', 'index', 'reference', 'repository'];
var Gitteh = module.exports = {};
Gitteh.bindings = bindings
, Gitteh.args = args
, Gitteh.utils = utils
, args.minOidLength = bindings.minOidLength;
Object.keys(helpers).forEach(function (fileName) {
var helper = helpers[fileName];
require("./" + helper).all(Gitteh, utils, args);
});
Gitteh.openRepository = function () {
var _ref = args({
path: {
type: 'string'
},
cb: {
type: 'function'
}
})
, path = _ref[0]
, cb = _ref[1];
return bindings.openRepository(path, utils._wrapCallback(cb, function (repo) {
return cb(null, new Gitteh.Repository(repo));
}));
};
Gitteh.openIndex = function () {
var _ref = args({
repo: {
type: "repository"
},
cb: {
type: "function"
}
})
, repo = _ref[0]
, cb = _ref[1];
return bindings.openIndex(repo, utils._wrapCallback(cb, function (repo) {
return cb(null, new Gitteh.Index(repo));
}));
}
Gitteh.initRepository = function () {
var _ref = args({
path: {
type: 'string'
},
bare: {
type: 'bool',
"default": false
},
cb: {
type: 'function'
}
})
, path = _ref[0]
, bare = _ref[1]
, cb = _ref[2];
return bindings.initRepository(path, bare, utils._wrapCallback(cb, function (repo) {
return cb(null, new Gitteh.Repository(repo));
}));
};
Gitteh.clone = function () {
};