Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
83 lines (73 loc) · 2.2 KB

File metadata and controls

83 lines (73 loc) · 2.2 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
78
79
80
81
82
83
var git = require('../');
var sha = '5716e9757886eaf38d51c86b192258c960d9cfea';
var getEntry = function(path, callback) {
git.Repo.open('repos/workdir/.git', function(error, repo) {
repo.getCommit(sha, function(error, commit) {
commit.getEntry(path, callback);
});
});
};
exports.missingFile = function(test) {
test.expect(1);
getEntry('test/convenience-entry.js', function(error, entry) {
test.notEqual(error, null, 'Missing file should error');
test.done();
});
};
exports.sha = function(test) {
test.expect(1);
getEntry('README.md', function(error, entry) {
var sha = entry.sha();
test.equal(sha, '6cb45ba5d32532bf0d1310dc31ca4f20f59964bc', 'Entry SHA should match expected value');
test.done();
});
};
exports.isFile = function(test) {
test.expect(2);
getEntry('README.md', function(error, entry) {
var isFile = entry.isFile();
test.equal(isFile, true, 'Entry is a file');
getEntry('example', function(error, entry) {
var isFile = entry.isFile();
test.equal(isFile, false, 'Entry is a directory');
test.done();
});
});
};
exports.isDirectory = function(test) {
test.expect(2);
getEntry('example', function(error, entry) {
test.equal(entry.isFile(), false, 'Entry is a directory');
getEntry('README.md', function(error, entry) {
test.equal(entry.isFile(), true, 'Entry is a file');
test.done();
});
});
};
exports.name = function(test) {
test.expect(2);
getEntry('test/raw-commit.js', function(error, entry) {
test.equal(error, null, 'Should not error');
var name = entry.name();
test.equal(name, 'raw-commit.js', 'Name should match expected value');
test.done();
});
};
exports.getBlob = function(test) {
test.expect(1);
getEntry('test/raw-commit.js', function(error, entry) {
entry.getBlob(function(error, blob) {
test.equal(blob.size(), 2736, 'Content length should match expected value');
test.done();
});
});
};
exports.getTree = function(test) {
test.expect(1);
getEntry('test', function(error, entry) {
entry.getTree(function(error, tree) {
test.equal(tree instanceof git.Tree, true, 'Expected instance of Tree');
test.done();
});
});
};
Morty Proxy This is a proxified and sanitized view of the page, visit original site.